Minimal command-line interpreter.
More...
#include <cli.hpp>
|
std::string | interpret (const std::string &line) const |
| Interprets a command line as a function invocation. More...
|
|
void | unregister_command (const std::string &name) |
| Unregisters a command from the CLI. More...
|
|
|
template<class T , class... Args> |
void | register_command (const std::string &name, const std::function< T(Args...)> &function) |
| Registers a command with the CLI. More...
|
|
template<class T , class... Args> |
void | register_command (const std::string &name, T(*function)(Args...)) |
| Registers a command with the CLI. More...
|
|
Minimal command-line interpreter.
Definition at line 35 of file cli.hpp.
◆ interpret()
std::string debug::cli::interpret |
( |
const std::string & |
line | ) |
const |
Interprets a command line as a function invocation.
- Parameters
-
- Returns
- Stringified return value of the command function.
Definition at line 24 of file cli.cpp.
◆ register_command() [1/2]
template<class T , class... Args>
void debug::cli::register_command |
( |
const std::string & |
name, |
|
|
const std::function< T(Args...)> & |
function |
|
) |
| |
Registers a command with the CLI.
- Template Parameters
-
T | Command function return type. |
Args | Command function argument types. |
- Parameters
-
name | Command name. |
function | Command function. |
Definition at line 100 of file cli.hpp.
◆ register_command() [2/2]
template<class T , class... Args>
void debug::cli::register_command |
( |
const std::string & |
name, |
|
|
T(*)(Args...) |
function |
|
) |
| |
Registers a command with the CLI.
- Template Parameters
-
T | Command function return type. |
Args | Command function argument types. |
- Parameters
-
name | Command name. |
function | Command function. |
Definition at line 106 of file cli.hpp.
◆ unregister_command()
void debug::cli::unregister_command |
( |
const std::string & |
name | ) |
|
Unregisters a command from the CLI.
- Parameters
-
Definition at line 38 of file cli.cpp.
The documentation for this class was generated from the following files: