Classes | |
| class | InteractiveCli |
| class | InteractiveQueryCli |
| class | InteractiveStatusCli |
| class | InteractiveTransactionCli |
| struct | ParamData |
Typedefs | |
| using | ParamsDescription = std::vector< ParamData > |
| using | DescriptionMap = std::unordered_map< std::string, std::string > |
| using | MenuPoints = std::vector< std::string > |
| using | ParamsMap = std::unordered_map< std::string, ParamsDescription > |
Enumerations | |
| enum | MenuContext { MAIN, RESULT } |
Functions | |
| DescriptionMap | getCommonDescriptionMap () |
| ParamsMap | getCommonParamsMap (const std::string &default_ip, int default_port) |
| ParamsDescription | makeParamsDescription (const std::vector< std::string > ¶ms) |
| void | handleEmptyCommand () |
| void | handleUnknownCommand (std::string &command) |
| void | addBackOption (MenuPoints &menu) |
| bool | isBackOption (std::string line) |
| void | printCommandParameters (std::string &command, const ParamsDescription ¶meters) |
| void | printMenu (const std::string &message, MenuPoints menu_points) |
| boost::optional< std::string > | promptString (const std::string &message) |
| boost::optional< std::string > | promptString (const ParamData ¶m) |
| void | printEnd () |
| boost::optional< std::pair< std::string, uint16_t > > | parseIrohaPeerParams (std::vector< std::string > params, const std::string &default_ip, int default_port) |
| boost::optional< std::vector< std::string > > | parseParams (std::string line, std::string command_name, ParamsMap ¶ms_map) |
| size_t | addMenuPoint (std::vector< std::string > &menu_points, const std::string &description, const std::string &command_short_name) |
| static void | printMenu (const MenuPoints &menu) |
| template<typename K , typename V > | |
| std::size_t | getNextIndex (std::unordered_map< K, V > parsers_map) |
| template<typename K , typename V > | |
| boost::optional< V & > | findInHandlerMap (K command_name, std::unordered_map< K, V > ¶ms_map) |
| template<typename T , typename V , typename C > | |
| boost::optional< T > | handleParse (C class_pointer, std::string &line, std::unordered_map< std::string, V > &parsers_map, ParamsMap ¶ms_map) |
| template<typename V > | |
| void | addCliCommand (MenuPoints &menu_points, std::unordered_map< std::string, V > &parsers_map, const std::string &command_name, const std::string &command_description, V parser) |
| template<typename V > | |
| MenuPoints | formMenu (std::unordered_map< std::string, V > &parsers_map, ParamsMap ¶msMap, const DescriptionMap descriptionMap) |
Variables | |
| static const std::map< iroha::protocol::TxStatus, std::string > | userMessageMap |
| const std::string | SAVE_CODE = "save" |
| const std::string | SEND_CODE = "send" |
| const std::string | BACK_CODE = "b" |
| using iroha_cli::interactive::DescriptionMap = typedef std::unordered_map<std::string, std::string> |
| using iroha_cli::interactive::MenuPoints = typedef std::vector<std::string> |
| using iroha_cli::interactive::ParamsDescription = typedef std::vector<ParamData> |
| using iroha_cli::interactive::ParamsMap = typedef std::unordered_map<std::string, ParamsDescription> |
| void iroha_cli::interactive::addBackOption | ( | MenuPoints & | menu | ) |
Add back option to menu
| menu | - menu to add the back option |

| void iroha_cli::interactive::addCliCommand | ( | MenuPoints & | menu_points, |
| std::unordered_map< std::string, V > & | parsers_map, | ||
| const std::string & | command_name, | ||
| const std::string & | command_description, | ||
| V | parser | ||
| ) |
Add new cli command to menu points and menu handlers (parsers)
| V | type of parser functions in parsers_map |
| menu_points | - menu to which points will be added |
| parsers_map | - map holding specific parser functions |
| command_name | - short command name |
| command_description | - description for the command |
| parser | - specific parser for current command |

| size_t iroha_cli::interactive::addMenuPoint | ( | std::vector< std::string > & | menu_points, |
| const std::string & | description, | ||
| const std::string & | command_short_name | ||
| ) |
Add menu point to vector menu
| menu_points | to add new point |
| description | of the command to add |
| command_short_name | command short name |

| boost::optional<V &> iroha_cli::interactive::findInHandlerMap | ( | K | command_name, |
| std::unordered_map< K, V > & | params_map | ||
| ) |
Find in unordered map with error reporting. Will print unkown command if key not found.
| K | key type |
| V | value type |
| command_name | - key to find in the map |
| params_map | - map |


| MenuPoints iroha_cli::interactive::formMenu | ( | std::unordered_map< std::string, V > & | parsers_map, |
| ParamsMap & | paramsMap, | ||
| const DescriptionMap | descriptionMap | ||
| ) |
Form menu points from given parameters and bind index of the command with their parser and parameters
| V | - type of specific parser functions in parsers_map |
| parsers_map | - map holding specific parser functions |
| paramsMap | - map holding descriptions for command parameters |
| descriptionMap | - map holding description of a command |


| DescriptionMap iroha_cli::interactive::getCommonDescriptionMap | ( | ) |
Return mapping of Command_name to Command description

| ParamsMap iroha_cli::interactive::getCommonParamsMap | ( | const std::string & | default_ip, |
| int | default_port | ||
| ) |
Return mapping of Command_name to parameters descriptions
| default_ip | - default hostname or IP to be used when connecting to irohad |
| default_port | - default port to be used when connecting to irohad |


| std::size_t iroha_cli::interactive::getNextIndex | ( | std::unordered_map< K, V > | parsers_map | ) |
Get next numerical index in the map. Used to build menu
| K | - key type in map |
| V | - value type in map |
| parsers_map | - map to process |
| void iroha_cli::interactive::handleEmptyCommand | ( | ) |
Handle error with empty command

| boost::optional<T> iroha_cli::interactive::handleParse | ( | C | class_pointer, |
| std::string & | line, | ||
| std::unordered_map< std::string, V > & | parsers_map, | ||
| ParamsMap & | params_map | ||
| ) |
Handle parsing routine:
| T | - expected return type of a parsing function |
| V | - type of the parser function in parsers_map |
| C | - class type of class_pointer |
| class_pointer | - class pointer that holds parser functions |
| line | - line to parse |
| parsers_map | - map holding parser functions |
| params_map | - map holding descriptions for command parameters |

| void iroha_cli::interactive::handleUnknownCommand | ( | std::string & | command | ) |
Handle error of unknown command
| command | - name of unknown command |

| bool iroha_cli::interactive::isBackOption | ( | std::string | line | ) |
Is line contains "Go Back" option
| line | to parse |


| ParamsDescription iroha_cli::interactive::makeParamsDescription | ( | const std::vector< std::string > & | params | ) |
Creates parameters descriptions with empty default/cache values
| params | - parameters as a vector of prompt messages |

| boost::optional< std::pair< std::string, uint16_t > > iroha_cli::interactive::parseIrohaPeerParams | ( | std::vector< std::string > | params, |
| const std::string & | default_ip, | ||
| int | default_port | ||
| ) |
Parse parameters related to Iroha Peer
| params | in format: vector of strings |

| boost::optional< std::vector< std::string > > iroha_cli::interactive::parseParams | ( | std::string | line, |
| std::string | command_name, | ||
| ParamsMap & | params_map | ||
| ) |
Parse parameters in interactive and shortcuted mode. Function run interactive mode if in line only the command name is passed. Function will parse all needed parameters from line if the line with commands is passed, it will print help if there are not enough parameters in line.
| line | - cli line to parse |
| command_name | - command name to print |
| notes | - parameters needed to run the command |


| void iroha_cli::interactive::printCommandParameters | ( | std::string & | command, |
| const ParamsDescription & | parameters | ||
| ) |
Print help for cli command.
| command | - name of the cli command |
| parameters | needed to run the command |

| void iroha_cli::interactive::printEnd | ( | ) |
Print end of session symbol

| void iroha_cli::interactive::printMenu | ( | const std::string & | message, |
| MenuPoints | menu_points | ||
| ) |
Pretty Print of menu
| message | - message to print before menu |
| menu_points | - elements of the menu |

|
static |

| boost::optional< std::string > iroha_cli::interactive::promptString | ( | const std::string & | message | ) |
Get string input from user
| message | Message to ask user |

| boost::optional< std::string > iroha_cli::interactive::promptString | ( | const ParamData & | param | ) |
Construct a prompt and get a string input from user
| param | Parameter to collect the input for |

| const std::string iroha_cli::interactive::BACK_CODE = "b" |
| const std::string iroha_cli::interactive::SAVE_CODE = "save" |
| const std::string iroha_cli::interactive::SEND_CODE = "send" |
|
static |