master
cpp 53 lines 1.19 KB
Raw
1 /*++
2
3 Copyright (c) Microsoft. All rights reserved.
4
5 Module Name:
6
7 SessionEnterCommand.cpp
8
9 Abstract:
10
11 Implementation of the session enter command.
12
13 --*/
14
15 #include "CLIExecutionContext.h"
16 #include "SessionCommand.h"
17 #include "SessionTasks.h"
18 #include "Task.h"
19
20 using namespace wsl::windows::wslc::execution;
21 using namespace wsl::windows::wslc::task;
22 using namespace wsl::shared;
23
24 namespace wsl::windows::wslc {
25
26 std::vector<Argument> SessionEnterCommand::GetArguments() const
27 {
28 return {
29 Argument::Create(ArgType::StoragePath, {.Required = true}),
30 Argument::Create(ArgType::Name, {.Desc = Localization::WSLCCLI_SessionEnterNameArgDescription()}),
31 };
32 }
33
34 std::wstring SessionEnterCommand::ShortDescription() const
35 {
36 return Localization::WSLCCLI_SessionEnterDesc();
37 }
38
39 std::wstring SessionEnterCommand::LongDescription() const
40 {
41 return Localization::WSLCCLI_SessionEnterLongDesc();
42 }
43
44 void SessionEnterCommand::ExecuteInternal(CLIExecutionContext& context) const
45 {
46 if (context.GlobalArgs.Contains(ArgType::Session))
47 {
48 throw ExecutionException(Localization::MessageWslcSessionOptionNotSupported());
49 }
50
51 context << EnterSession;
52 }
53 } // namespace wsl::windows::wslc