|
lintel 0.2.0
|
#include <CommandLineComponent.h>
Public Member Functions | |
| CommandLineComponent (std::string_view name, std::string_view alias) | |
| virtual | ~CommandLineComponent ()=default |
| std::string_view | getName () |
| std::string_view | getAlias () |
| virtual void | onCommand (const UserDto &userDto, const std::string &command, const std::vector< std::string > ¶meters)=0 |
| virtual void | onHelp ()=0 |
| virtual void | onShowMenu ()=0 |
| virtual bool | onMenu (const std::string &component)=0 |
| virtual bool | onExit ()=0 |
| virtual void | printCommandList (std::set< std::string > menuAlias)=0 |
| virtual std::set< std::string > | menuEntriesOf () |
| virtual std::vector< std::string > | allCommandsOf ()=0 |
Abstract base class for all CLI components (menus/screens)
| lintel::CommandLineComponent::CommandLineComponent | ( | std::string_view | name, |
| std::string_view | alias | ||
| ) |
| name | display name of the component |
| alias | short alias for navigation |
|
virtualdefault |
|
pure virtual |
Implemented in lintel::HistoryCliComponent, lintel::MessageQueueCliComponent, lintel::ProcessCliComponent, lintel::PropertyCliComponent, lintel::SharedMemoryCliComponent, and lintel::UserManagementCliComponent.
| std::string_view lintel::CommandLineComponent::getAlias | ( | ) |
| std::string_view lintel::CommandLineComponent::getName | ( | ) |
|
inlinevirtual |
Empty by default: a component without sub-menus (every built-in one) does not override this, and the menu loop treats the empty set as "nothing to navigate into". Components that do build a hierarchy override it.
|
pure virtual |
Handle a command entered by the user
Implemented in lintel::HistoryCliComponent, lintel::MessageQueueCliComponent, lintel::ProcessCliComponent, lintel::PropertyCliComponent, lintel::SharedMemoryCliComponent, and lintel::UserManagementCliComponent.
CommandLineService currently discards the result and exits either way; a component that can veto the exit overrides this.
Implemented in lintel::HistoryCliComponent, lintel::MessageQueueCliComponent, lintel::ProcessCliComponent, lintel::PropertyCliComponent, lintel::SharedMemoryCliComponent, and lintel::UserManagementCliComponent.
Show help for this component
Implemented in lintel::HistoryCliComponent, lintel::MessageQueueCliComponent, lintel::ProcessCliComponent, lintel::PropertyCliComponent, lintel::SharedMemoryCliComponent, and lintel::UserManagementCliComponent.
| component | name to navigate to; return true if handled |
Reached with input that CommandParser could not classify, i.e. with a free-text line rather than a real command. CommandLineService prints "Invalid command" for a component that returns false, so a component without sub-menus returns false - returning true unconditionally would swallow every typo at the prompt without a word.
Implemented in lintel::HistoryCliComponent, lintel::MessageQueueCliComponent, lintel::ProcessCliComponent, lintel::PropertyCliComponent, lintel::SharedMemoryCliComponent, and lintel::UserManagementCliComponent.
Show the menu for this component
Implemented in lintel::HistoryCliComponent, lintel::MessageQueueCliComponent, lintel::ProcessCliComponent, lintel::PropertyCliComponent, lintel::SharedMemoryCliComponent, and lintel::UserManagementCliComponent.
|
pure virtual |
Print the list of available commands
Implemented in lintel::HistoryCliComponent, lintel::MessageQueueCliComponent, lintel::ProcessCliComponent, lintel::PropertyCliComponent, lintel::SharedMemoryCliComponent, and lintel::UserManagementCliComponent.