lintel 0.2.0
Loading...
Searching...
No Matches
ProcessCliComponent.h
Go to the documentation of this file.
1#ifndef LINTEL_PROCESSCLICOMPONENT_H
2#define LINTEL_PROCESSCLICOMPONENT_H
3
7
8namespace lintel {
11{
12private:
13 static constexpr std::string_view m_name = "Process";
14 static constexpr std::string_view m_alias = "Pros";
15 static constexpr std::string_view m_description = "The component can be used to show all kind of processes.";
16 std::shared_ptr<ProcessApi> m_processApi;
17
18 // Commands
19 enum Commands {
20 Undefined,
21 ShowProcesses,
22 ShowProcessGroups,
23 StartProcess,
24 StopProcess,
25 TerminateProcess,
26 RestartProcess,
27 ResetProcess,
28 ShowProcessDetails
29 };
30
31 // Flags
32 std::optional<std::string> m_processName;
33 std::optional<std::string> m_processGroup;
34 std::vector<std::string> m_arguments;
35 std::optional<int32_t> m_restarts;
36 std::string m_processId;
37
39
41 static void printProcesses(const std::vector<ProcessInfoDto> &processInfo);
42
44 static void printProcessGroups(const std::vector<ProcessGroupDto> &processGroup);
45
47 static void printProcessDetails(const ProcessInfoDto &processInfo);
48
49public:
51 explicit ProcessCliComponent(std::shared_ptr<ProcessApi> processApi);
52
53 void onCommand(const UserDto &userDto, const std::string &input, const std::vector<std::string> &parameters) override;
54
55 void onHelp() override;
56
57 void onShowMenu() override;
58
59 bool onMenu(const std::string &component) override;
60
61 bool onExit() override;
62
63 void printCommandList(std::set<std::string> menuAlias) override;
64
65 std::vector<std::string> allCommandsOf() override;
66};
67
68}// namespace lintel
69#endif// LINTEL_PROCESSCLICOMPONENT_H
Definition CommandLineComponent.h:17
Definition CommandParser.h:21
Definition ProcessCliComponent.h:11
std::vector< std::string > allCommandsOf() override
void onShowMenu() override
ProcessCliComponent(std::shared_ptr< ProcessApi > processApi)
void printCommandList(std::set< std::string > menuAlias) override
bool onMenu(const std::string &component) override
void onCommand(const UserDto &userDto, const std::string &input, const std::vector< std::string > &parameters) override
Definition ProcessInfoDto.h:16
Definition UserDto.h:16
Definition BaseFeature.h:6
constexpr std::string_view type_name()
Definition TypeName.h:9