-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathRootCommand.cpp
More file actions
85 lines (71 loc) · 2.99 KB
/
RootCommand.cpp
File metadata and controls
85 lines (71 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*++
Copyright (c) Microsoft. All rights reserved.
Module Name:
RootCommand.cpp
Abstract:
Implementation of the RootCommand, which is the root of all commands in the CLI.
--*/
#include "RootCommand.h"
// Include all commands that parent to the root.
#include "ContainerCommand.h"
#include "ImageCommand.h"
#include "SessionCommand.h"
#include "SettingsCommand.h"
#include "VersionCommand.h"
#include "VolumeCommand.h"
using namespace wsl::windows::wslc::execution;
using namespace wsl::shared;
namespace wsl::windows::wslc {
std::vector<std::unique_ptr<Command>> RootCommand::GetCommands() const
{
std::vector<std::unique_ptr<Command>> commands;
commands.push_back(std::make_unique<ContainerCommand>(FullName()));
commands.push_back(std::make_unique<ImageCommand>(FullName()));
commands.push_back(std::make_unique<SessionCommand>(FullName()));
commands.push_back(std::make_unique<SettingsCommand>(FullName()));
commands.push_back(std::make_unique<VolumeCommand>(FullName()));
commands.push_back(std::make_unique<ContainerAttachCommand>(FullName()));
commands.push_back(std::make_unique<ImageBuildCommand>(FullName()));
commands.push_back(std::make_unique<ContainerCreateCommand>(FullName()));
commands.push_back(std::make_unique<ContainerExecCommand>(FullName()));
commands.push_back(std::make_unique<ImageListCommand>(FullName(), true));
commands.push_back(std::make_unique<ContainerInspectCommand>(FullName()));
commands.push_back(std::make_unique<ContainerKillCommand>(FullName()));
commands.push_back(std::make_unique<ContainerListCommand>(FullName()));
commands.push_back(std::make_unique<ImageLoadCommand>(FullName()));
commands.push_back(std::make_unique<ContainerLogsCommand>(FullName()));
commands.push_back(std::make_unique<ImagePullCommand>(FullName()));
commands.push_back(std::make_unique<ContainerRemoveCommand>(FullName()));
commands.push_back(std::make_unique<ImageRemoveCommand>(FullName(), true));
commands.push_back(std::make_unique<ContainerRunCommand>(FullName()));
commands.push_back(std::make_unique<ImageSaveCommand>(FullName()));
commands.push_back(std::make_unique<ContainerStartCommand>(FullName()));
commands.push_back(std::make_unique<ContainerStopCommand>(FullName()));
commands.push_back(std::make_unique<ImageTagCommand>(FullName()));
commands.push_back(std::make_unique<VersionCommand>(FullName()));
return commands;
}
std::vector<Argument> RootCommand::GetArguments() const
{
return {
Argument::Create(ArgType::Version),
};
}
std::wstring RootCommand::ShortDescription() const
{
return Localization::WSLCCLI_RootCommandDesc();
}
std::wstring RootCommand::LongDescription() const
{
return Localization::WSLCCLI_RootCommandLongDesc();
}
void RootCommand::ExecuteInternal(CLIExecutionContext& context) const
{
if (context.Args.Contains(ArgType::Version))
{
VersionCommand::PrintVersion();
return;
}
OutputHelp();
}
} // namespace wsl::windows::wslc