An extension to o2scl::cli which uses readline. More...
#include <cli_readline.h>
This header-only class requires the GNU readline library for use, but is not referenced by O2scl code at the moment to make the library usable without readline.
Definition at line 45 of file cli_readline.h.
Public Member Functions | |
| cli_readline (std::string fname="", size_t max_size=100) | |
| void | set_histfile (std::string fname) |
| Set history file. | |
| virtual char * | cli_gets (const char *c) |
| Function to get a string from the user. More... | |
Public Member Functions inherited from o2scl::cli | |
| int | set_comm_option (comm_option_s &ic) |
| Add a new command. More... | |
| void | remove_comm_option (std::string cmd) |
Remove a command with long name cmd. | |
| template<class vec_t > | |
| int | set_comm_option_vec (size_t list_size, vec_t &option_list) |
| Add a vector containing new commands/options. | |
| int | set_param_help (std::string param, std::string help) |
Set one-line help text for a parameter named param. | |
| int | run_auto (int argc, char *argv[], int debug=0) |
| Automatically parse arguments to main and call interactive mode if required. | |
| int | call_args (std::vector< cmd_line_arg > &ca, int debug=0) |
| Call functions corresponding to command-line args. | |
| int | process_args_c (int argc, char *argv[], std::vector< cmd_line_arg > &ca, int debug=0, bool also_call_args=false) |
| Process command-line arguments from a const char array. More... | |
| int | parse_for_aliases (std::vector< std::string > &svsv) |
| int | process_args (std::vector< std::string > &sv, std::vector< cmd_line_arg > &ca, int debug, bool also_call_args=false) |
| Process command-line arguments from a vector of strings. More... | |
| int | process_args_str (std::string s, std::vector< cmd_line_arg > &ca, int debug=0, bool also_call_args=false) |
| Process command-line arguments from a string. More... | |
| int | set_verbose (int v) |
| Set verbosity. More... | |
| int | run_interactive () |
| Run the interactive mode. | |
| int | set_alias (std::string alias, std::string str) |
Set an alias alias for the string str. More... | |
| std::string | get_alias (std::string alias) |
Set an alias alias for the string str. More... | |
| bool | is_valid_option (std::string str) |
Return true if str is a valid option. | |
| cli () | |
| virtual | ~cli () |
| int | comm_option_alias (std::vector< std::string > &sv, bool itive_com) |
| int | comm_option_commands (std::vector< std::string > &sv, bool itive_com) |
| int | comm_option_get (std::vector< std::string > &sv, bool itive_com) |
| int | comm_option_help (std::vector< std::string > &sv, bool itive_com) |
| int | comm_option_license (std::vector< std::string > &sv, bool itive_com) |
| int | comm_option_no_intro (std::vector< std::string > &sv, bool itive_com) |
| int | comm_option_run (std::vector< std::string > &sv, bool itive_com) |
| int | comm_option_shell (std::vector< std::string > &sv, bool itive_com) |
| int | comm_option_set (std::vector< std::string > &sv, bool itive_com) |
| int | comm_option_warranty (std::vector< std::string > &sv, bool itive_com) |
| int | apply_aliases (std::vector< std::string > &sv, size_t istart, bool debug=false) |
Replace all occurences of sold with snew in sv. | |
| int | set_function (comm_option_funct &usf) |
Function to call when a set command is issued. | |
Protected Attributes | |
| char * | line_read |
| Buffer for readline. | |
| std::string | histfile |
| String containing filename. | |
| size_t | msize |
| Maximum history file size. | |
Protected Attributes inherited from o2scl::cli | |
| std::vector< std::string > | ph_name |
| std::vector< std::string > | ph_desc |
| int | verbose |
| Control screen output. | |
| char | buf [300] |
| Storage for getline. | |
| comm_option_funct * | user_set_func |
| Storage for the function to call after setting a parameter. | |
| std::vector< comm_option_s > | clist |
| List of commands. | |
| std::map< std::string, std::string, std::greater< std::string > > | als |
Additional Inherited Members | |
Public Types inherited from o2scl::cli | |
| typedef std::map< std::string, parameter *, std::greater< std::string > >::iterator | par_t |
| List iterator. | |
Public Attributes inherited from o2scl::cli | |
| comm_option_s | c_commands |
| comm_option_s | c_help |
| comm_option_s | c_quit |
| comm_option_s | c_exit |
| comm_option_s | c_license |
| comm_option_s | c_warranty |
| comm_option_s | c_set |
| comm_option_s | c_get |
| comm_option_s | c_run |
| comm_option_s | c_shell |
| comm_option_s | c_no_intro |
| comm_option_s | c_alias |
| bool | sync_verbose |
| If true, then sync cli::verbose, with a parameter of the same name. | |
| bool | shell_cmd_allowed |
| If true, allow the user to use ! to execute a shell command (default true) | |
| std::string | prompt |
The prompt (default "> ") | |
| std::string | desc |
| A one- or two-line description (default is empty string) | |
| std::string | cmd_name |
| The name of the command. | |
| std::string | addl_help_cmd |
| Additional help text for interactive mode (default is empty string) | |
| std::string | addl_help_cli |
| Additional help text for command-line (default is empty string) | |
| std::map< std::string, parameter *, std::less< std::string > > | par_list |
| Parameter list. | |
| std::string | tilde_string |
| String to replace tildes with. | |
| bool | gnu_intro |
| If true, output the usual GNU intro when run_interactive() is called (default true). More... | |
Static Public Attributes inherited from o2scl::cli | |
| static const int | comm_option_command =0 |
| static const int | comm_option_cl_param =1 |
| static const int | comm_option_both =2 |
Protected Types inherited from o2scl::cli | |
| typedef std::map< std::string, std::string, std::greater< std::string > >::iterator | al_it |
Protected Member Functions inherited from o2scl::cli | |
| int | output_param_list () |
| Output the parameter list. | |
| bool | string_equal_dash (std::string s1, std::string s2) |
| Compare two strings, treating dashes and underscores as equivalent. | |
|
inlinevirtual |
Reimplemented from o2scl::cli.
Definition at line 90 of file cli_readline.h.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).