Antkeeper  0.0.1
Public Member Functions | List of all members
debug::cli Class Reference

Minimal command-line interpreter. More...

#include <cli.hpp>

Public Member Functions

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...
 

Detailed Description

Minimal command-line interpreter.

Definition at line 35 of file cli.hpp.

Member Function Documentation

◆ interpret()

std::string debug::cli::interpret ( const std::string &  line) const

Interprets a command line as a function invocation.

Parameters
lineCommand line.
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
TCommand function return type.
ArgsCommand function argument types.
Parameters
nameCommand name.
functionCommand 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
TCommand function return type.
ArgsCommand function argument types.
Parameters
nameCommand name.
functionCommand 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
nameCommand name.

Definition at line 38 of file cli.cpp.


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