37 #ifndef SCSL_COMMANDER_H
38 #define SCSL_COMMANDER_H
73 : fn(func), args(argc), command(name)
77 std::string
Name() {
return this->command; }
119 std::map<std::string, Subcommand *> cmap;
Definition: Commander.h:108
Commander()
A Commander is initialized empty.
Definition: Commander.cc:47
Subcommand::Status Run(std::string command, int argc, char **argv)
Try to run a subcommand registered with this Commander.
Definition: Commander.cc:67
bool Register(Subcommand scmd)
Register adds the subcommand. It will be copied into the Commander.
Definition: Commander.cc:54
Definition: Commander.h:51
std::string Name()
Name returns the name of this subcommand.
Definition: Commander.h:77
Status Run(int argc, char **argv)
Definition: Commander.cc:32
Subcommand(std::string name, int argc, CommanderFunc func)
Definition: Commander.h:72
Status
Status describes the results of running a Subcommand.
Definition: Commander.h:54
@ Failed
The subcommand failed to run correctly.
@ NotEnoughArgs
Not enough arguments were supplied to the subcommand.
@ OK
The subcommand executed correctly.
scsl is the top-level namespace containing all the code in this library.
Definition: scsl.h:43
std::function< bool(int, char **)> CommanderFunc
Definition: Commander.h:46