26 #ifndef HYPERTABLE_INTERACTIVECOMMAND_H
27 #define HYPERTABLE_INTERACTIVECOMMAND_H
73 virtual const char **
usage() = 0;
76 virtual void run() = 0;
82 void push_arg(std::string key, std::string value) {
83 m_args.push_back(std::pair<std::string, std::string>(key, value));
88 std::vector< std::pair<std::string, std::string> >
m_args;
99 #endif // HYPERTABLE_INTERACTIVECOMMAND_H
virtual const char * command_text()=0
Returns the command text (i.e.
void push_arg(std::string key, std::string value)
Append another key/value pair to the argument list.
virtual const char ** usage()=0
Returns the usage string.
bool parse_string_literal(const char *str, std::string &text, const char **endptr)
Helper function to parse a string literal.
Po::typed_value< String > * str(String *v=0)
Abstract base class for simple interactive shell commands.
virtual void run()=0
Runs the command; can access the command line arguments in m_args.
virtual ~InteractiveCommand()
Virtual destructor can be overwritten in subclasses.
bool matches(const char *line)
Returns true if the command_text() matches the command line.
void clear_args()
Clears all arguments.
std::vector< std::pair< std::string, std::string > > m_args
The vector with key/value pairs for this command.
void parse_command_line(const char *line)
Parses a command line and stores the arguments in m_args.