|
|
typedef XorpCallback2<bool, const string&, string&>::RefPtr TypeMatchCb | TypeMatchCb |
CliCommand (CliCommand *init_parent_command,
const string& init_command_name,
const string& init_command_help)
| CliCommand |
Constructor for a given parent command, command name, and command help.
Parameters:
init_parent_command | the parent CliCommand command. |
init_command_name | the command name (this name should not include the command name of the parent command and its ancestors). |
init_command_help | the command help. |
~CliCommand ()
| ~CliCommand |
[virtual]
void set_allow_cd (bool v, const string& init_cd_prompt)
| set_allow_cd |
Enable/disable whether this command allows "change directory" to it.
Parameters:
v | if true, enable "change directory", otherwise disable it. |
init_cd_prompt | if v is true, the CLI prompt to display when "cd" to this command. If an empty string, the CLI prompt will not be changed. |
int create_default_cli_commands ()
| create_default_cli_commands |
Create the default CLI commands at each level of the command tree.
Returns: XORP_OK on success, otherwise XORP_ERROR.
int add_pipes ()
| add_pipes |
Create and add the default CLI pipe commands.
Returns: XORP_OK on success, otherwise XORP_ERROR.
CliCommand * add_command (const string& init_command_name,
const string& init_command_help,
bool is_multilevel_command)
| add_command |
Add a CLI command.
By default, we cannot "cd" to this command.
Parameters:
init_command_name | the command name to add. If is_multilevel_command is true, then it may include more than one command levels in the middle. E.g., "show version pim". However, commands "show" and "show version" must have been installed first. |
init_command_help | the command help. |
is_multilevel_command | if true, then init_command_name may include more than one command levels in the middle. |
Returns: the new child command on success, otherwise NULL.
CliCommand * add_command (const string& init_command_name,
const string& init_command_help,
const string& init_cd_prompt,
bool is_multilevel_command)
| add_command |
Add a CLI command we can "cd" to it.
By default, we can "cd" to this command.
Parameters:
init_command_name | the command name to add. If is_multilevel_command is true, then it may include more than one command levels in the middle. E.g., "set pim bsr". However, commands "set" and "set pim" must have been installed first. |
init_command_help | the command help. |
init_cd_prompt | if not an empty string, the CLI prompt when "cd" to this command. |
is_multilevel_command | if true, then init_command_name may include more than one command levels in the middle. |
Returns: the new child command on success, otherwise NULL.
CliCommand * add_command (const string& init_command_name,
const string& init_command_help,
bool is_multilevel_command,
const CLI_PROCESS_CALLBACK& init_cli_process_callback)
| add_command |
Add a CLI command with a processing callback.
Parameters:
init_command_name | the command name to add. If is_multilevel_command is true, then it may include more than one command levels in the middle. E.g., "show version pim". However, commands "show" and "show version" must have been installed first. |
init_command_help | the command help. |
is_multilevel_command | if true, then init_command_name may include more than one command levels in the middle. |
init_cli_process_callback | the callback to call when the command is entered for execution from the command-line. |
Returns: the new child command on success, otherwise NULL.
CliCommand * add_command (const string& init_command_name,
const string& init_command_help,
bool is_multilevel_command,
const CLI_PROCESS_CALLBACK& init_cli_process_callback,
const CLI_INTERRUPT_CALLBACK& init_cli_interrupt_callback)
| add_command |
Add a CLI command with a processing and an interrupt callbacks.
Parameters:
init_command_name | the command name to add. If is_multilevel_command is true, then it may include more than one command levels in the middle. E.g., "show version pim". However, commands "show" and "show version" must have been installed first. |
init_command_help | the command help. |
is_multilevel_command | if true, then init_command_name may include more than one command levels in the middle. |
init_cli_process_callback | the callback to call when the command is entered for execution from the command-line. |
init_cli_interrupt_callback | the callback to call when the user has interrupted the command (e.g., by typing Ctrl-C). |
Returns: the new child command on success, otherwise NULL.
CliCommand * add_command (const string& init_command_name,
const string& init_command_help,
bool is_multilevel_command,
CLI_PROCESS_FUNC init_cli_process_func)
| add_command |
Add a CLI command with a processing function.
Parameters:
init_command_name | the command name to add. If is_multilevel_command is true, then it may include more than one command levels in the middle. E.g., "show version pim". However, commands "show" and "show version" must have been installed first. |
init_command_help | the command help. |
is_multilevel_command | if true, then init_command_name may include more than one command levels in the middle. |
init_cli_process_func | the processing function to call when the command is entered for execution from the command-line. |
Returns: the new child command on success, otherwise NULL.
CliCommand * add_command (const string& init_command_name,
const string& init_command_help,
bool is_multilevel_command,
CLI_PROCESS_FUNC init_cli_process_func,
CLI_INTERRUPT_FUNC init_cli_interrupt_func)
| add_command |
Add a CLI command with a processing function and an interrupt handler.
Parameters:
init_command_name | the command name to add. If is_multilevel_command is true, then it may include more than one command levels in the middle. E.g., "show version pim". However, commands "show" and "show version" must have been installed first. |
init_command_help | the command help. |
is_multilevel_command | if true, then init_command_name may include more than one command levels in the middle. |
init_cli_process_func | the processing function to call when the command is entered for execution from the command-line. |
init_cli_interrupt_func | the function to call when the user has interrupted the command (e.g., by typing Ctrl-C). |
Returns: the new child command on success, otherwise NULL.
int add_command (CliCommand *child_command)
| add_command |
Add a child CLI command.
Parameters:
child_command | the child command to add. |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int delete_command (CliCommand *child_command)
| delete_command |
Delete a child command and all sub-commands below it.
Parameters:
child_command | the child command to delete. |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int delete_command (const string& delete_command_name)
| delete_command |
Delete a child command and all sub-commands below it.
Parameters:
delete_command_name | the name of the child command to delete. The name can be the full path-name for that command. |
Returns: XORP_OK on success, otherwise XORP_ERROR.
void delete_all_commands ()
| delete_all_commands |
Recursively delete all children of this command.
void set_can_pipe (bool v)
| set_can_pipe |
Set whether the output of this command can be piped.
Parameters:
v | if true, then the the output of this command can be piped. |
bool default_nomore_mode ()
| default_nomore_mode |
[const]
Test if "no-more" (i.e., unpaged) is the default output mode.
Returns: true if "no-more" (i.e., unpaged) is the default output mode, otherwise false.
void set_default_nomore_mode (bool v)
| set_default_nomore_mode |
Set the default paging mode.
Parameters:
v | if true, then "no-more" (i.e., unpaged) is the default output mode. |
bool is_command_argument ()
| is_command_argument |
[const]
Test if the command actually represents a command argument.
Returns: true if the command actually represents a command argument.
void set_is_command_argument (bool v)
| set_is_command_argument |
Set a flag whether the command actually represents a command argument.
Parameters:
v | true if the command represents a command argument, otherwise false. |
bool is_argument_expected ()
| is_argument_expected |
[const]
Test if the command expects an argument.
Returns: true if the command expects an argument, otherwise false.
void set_is_argument_expected (bool v)
| set_is_argument_expected |
Set a flag whether the command expects an argument.
Parameters:
v | true if the command expectes an argument, otherwise false. |
const TypeMatchCb& type_match_cb ()
| type_match_cb |
[const]
Get the callback for type matching.
Returns: the callback for type matching.
void set_type_match_cb (const TypeMatchCb& cb)
| set_type_match_cb |
Set the callback for type matching.
Parameters:
cb | the callback for type matching. |
bool has_type_match_cb ()
| has_type_match_cb |
[const]
Test if there is a callback for type matching.
Returns: true if there is a callback for type matching, otherwise false.
const vector<string>& global_name ()
| global_name |
[const]
Get the global name of this command (i.e., the full name starting from the root).
Returns: the global (full) name of this command.
void set_global_name (const vector<string>& v)
| set_global_name |
Set the global name for this command.
Parameters:
v | the global name value to set. |
const string& server_name ()
| server_name |
[const]
Get the server (i.e., processor) name for this command.
Returns: the server name for this command.
void set_server_name (const string& v)
| set_server_name |
Set the server (i.e., processor) name for this command.
Parameters:
v | the server name value to set. |
void set_dynamic_children_callback (DYNAMIC_CHILDREN_CALLBACK v)
| set_dynamic_children_callback |
Set the callback for dynamic generation of children commands.
Parameters:
v | the callback for dynamic generation of children commands. |
void set_dynamic_process_callback (const CLI_PROCESS_CALLBACK& v)
| set_dynamic_process_callback |
Set the callback for command processing for a dynamically generated child command.
Parameters:
v | the callback for command processing. |
void set_dynamic_interrupt_callback (const CLI_INTERRUPT_CALLBACK& v)
| set_dynamic_interrupt_callback |
Set the callback for command interrupt for a dynamically generated child command.
Parameters:
v | the callback for command processing. |
void set_cli_process_callback (const CLI_PROCESS_CALLBACK& v)
| set_cli_process_callback |
Set the callback for command processing.
Parameters:
v | the callback for command processing. |
void set_cli_interrupt_callback (const CLI_INTERRUPT_CALLBACK& v)
| set_cli_interrupt_callback |
Set the callback for command interrupt.
Parameters:
v | the callback for command processing. |