lintel 0.2.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
lintel::HistoryCliComponent Class Reference

#include <HistoryCliComponent.h>

Inheritance diagram for lintel::HistoryCliComponent:
lintel::CommandLineComponent

Public Member Functions

 HistoryCliComponent (std::shared_ptr< HistoryApi > historyApi)
 
void onHelp () override
 
void onCommand (const UserDto &userDto, const std::string &command, const std::vector< std::string > &parameters) override
 
void onShowMenu () override
 
bool onMenu (const std::string &component) override
 
bool onExit () override
 
void printCommandList (std::set< std::string > menuAlias) override
 
std::vector< std::string > allCommandsOf () override
 
- Public Member Functions inherited from lintel::CommandLineComponent
 CommandLineComponent (std::string_view name, std::string_view alias)
 
virtual ~CommandLineComponent ()=default
 
std::string_view getName ()
 
std::string_view getAlias ()
 
virtual std::set< std::string > menuEntriesOf ()
 

Detailed Description

CLI component that displays command history

Constructor & Destructor Documentation

◆ HistoryCliComponent()

lintel::HistoryCliComponent::HistoryCliComponent ( std::shared_ptr< HistoryApi >  historyApi)
explicit
Parameters
historyApiAPI for retrieving history data

Member Function Documentation

◆ allCommandsOf()

std::vector< std::string > lintel::HistoryCliComponent::allCommandsOf ( )
overridevirtual
Returns
vector of all command names

Implements lintel::CommandLineComponent.

◆ onCommand()

void lintel::HistoryCliComponent::onCommand ( const UserDto &  userDto,
const std::string &  command,
const std::vector< std::string > &  parameters 
)
overridevirtual

Handle a command entered by the user

Implements lintel::CommandLineComponent.

◆ onExit()

bool lintel::HistoryCliComponent::onExit ( )
overridevirtual
Returns
true if exit was confirmed

CommandLineService currently discards the result and exits either way; a component that can veto the exit overrides this.

Implements lintel::CommandLineComponent.

◆ onHelp()

void lintel::HistoryCliComponent::onHelp ( )
overridevirtual

Show help for this component

Implements lintel::CommandLineComponent.

◆ onMenu()

bool lintel::HistoryCliComponent::onMenu ( const std::string &  component)
overridevirtual
Parameters
componentname 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.

Implements lintel::CommandLineComponent.

◆ onShowMenu()

void lintel::HistoryCliComponent::onShowMenu ( )
overridevirtual

Show the menu for this component

Implements lintel::CommandLineComponent.

◆ printCommandList()

void lintel::HistoryCliComponent::printCommandList ( std::set< std::string >  menuAlias)
overridevirtual

Print the list of available commands

Implements lintel::CommandLineComponent.


The documentation for this class was generated from the following file: