|
myshell 2.0.0
|
Built-in commands and related utilities. More...
Functions | |
| bool | is_builtin (const std::string &cmd) |
| Check if a command is a built-in command. | |
| bool | handle_help (int argc, char **argv, const builtin_doc &doc) |
| Check if help flag is present in arguments and print help message if it is. | |
Variables | |
| const std::map< std::string, builtin > | builtin_commands |
| Internal map of built-in commands. | |
| std::map< std::string, std::string > | aliases |
| Internal map of aliases. | |
Built-in commands and related utilities.
| bool handle_help | ( | int | argc, |
| char ** | argv, | ||
| const builtin_doc & | doc ) |
Check if help flag is present in arguments and print help message if it is.
If unknown flags are present, throws an exception intended to be caught by the internal command handler.
| argc | Number of arguments. |
| argv | Array of arguments. |
| doc | Documentation of the command. |
| boost::program_options::error | if arguments are invalid. |
| bool is_builtin | ( | const std::string & | cmd | ) |
Check if a command is a built-in command.
| cmd | Command to check. |
| std::map<std::string, std::string> aliases |
Internal map of aliases.
Maps alias names to their corresponding commands.
| const std::map<std::string, builtin> builtin_commands |
Internal map of built-in commands.
Maps command names to their corresponding built-in commands.