master
cpp 61 lines 1.63 KB
Raw
1 /*++
2
3 Copyright (c) Microsoft. All rights reserved.
4
5 Module Name:
6
7 ContainerExecCommand.cpp
8
9 Abstract:
10
11 Implementation of command execution logic.
12
13 --*/
14
15 #include "ContainerCommand.h"
16 #include "CLIExecutionContext.h"
17 #include "ContainerTasks.h"
18 #include "SessionTasks.h"
19 #include "Task.h"
20
21 using namespace wsl::windows::wslc::execution;
22 using namespace wsl::windows::wslc::task;
23 using namespace wsl::shared;
24
25 namespace wsl::windows::wslc {
26 // Container Exec Command
27 std::vector<Argument> ContainerExecCommand::GetArguments() const
28 {
29 return {
30 Argument::Create(ArgType::ContainerId, {.Required = true}),
31 Argument::Create(ArgType::Command, {.Required = true}),
32 Argument::Create(ArgType::ForwardArgs, {.Desc = Localization::WSLCCLI_ContainerExecForwardArgsDescription()}),
33 Argument::Create(ArgType::Detach),
34 Argument::Create(ArgType::Env, {.Limit = Limit::Unlimited}),
35 Argument::Create(ArgType::EnvFile, {.Limit = Limit::Unlimited}),
36 Argument::Create(ArgType::Interactive),
37 Argument::Create(ArgType::TTY),
38 Argument::Create(ArgType::User),
39 Argument::Create(ArgType::WorkDir),
40 };
41 }
42
43 std::wstring ContainerExecCommand::ShortDescription() const
44 {
45 return Localization::WSLCCLI_ContainerExecDesc();
46 }
47
48 std::wstring ContainerExecCommand::LongDescription() const
49 {
50 return Localization::WSLCCLI_ContainerExecLongDesc();
51 }
52 // clang-format off
53 void ContainerExecCommand::ExecuteInternal(CLIExecutionContext& context) const
54 {
55 context
56 << ResolveSession
57 << SetContainerOptionsFromArgs
58 << ExecContainer;
59 }
60 // clang-format on
61 } // namespace wsl::windows::wslc