38#ifndef SCSL_COMMANDER_H
39#define SCSL_COMMANDER_H
76 : fn(func), requiredArgs(argc), command(name)
80 std::string
Name() {
return this->command; }
123 std::map<std::string, Subcommand *> cmap;
Subcommander manager for programs.
Definition Commander.h:112
Subcommand::Status Run(std::string command, std::vector< std::string > args)
Try to run a subcommand registered with this Commander.
Commander()
A Commander is initialized empty.
bool Register(Subcommand scmd)
Register adds the subcommand. It will be copied into the Commander.
Subcommands used by Commander.
Definition Commander.h:54
Status
Status describes the results of running a Subcommand.
Definition Commander.h:57
@ Failed
The subcommand failed to run correctly.
@ NotEnoughArgs
Not enough arguments were supplied to the subcommand.
@ OK
The subcommand executed correctly.
Subcommand(std::string name, size_t argc, CommanderFunc func)
Definition Commander.h:75
Status Run(std::vector< std::string > args)
std::string Name()
Name returns the name of this subcommand.
Definition Commander.h:80
scsl is the top-level namespace containing all the code in this library.
Definition scsl.h:43
std::function< bool(std::vector< std::string >)> CommanderFunc
Definition Commander.h:47