scsl 1.0.1
Shimmering Clarity Standard Library
|
Subcommands used by Commander. More...
#include <Commander.h>
Public Types | |
enum class | Status : int8_t { OK = 0 , NotEnoughArgs = 1 , Failed = 2 , CommandNotRegistered = 3 } |
Status describes the results of running a Subcommand. More... | |
Public Member Functions | |
Subcommand (std::string name, size_t argc, CommanderFunc func) | |
std::string | Name () |
Name returns the name of this subcommand. | |
Status | Run (std::vector< std::string > args) |
Subcommands used by Commander.
Subcommands are the individual commands for the program. A Subcommand will check that it has enough arguments before running its function.
|
strong |
Status describes the results of running a Subcommand.
Enumerator | |
---|---|
OK | The subcommand executed correctly. |
NotEnoughArgs | Not enough arguments were supplied to the subcommand. |
Failed | The subcommand failed to run correctly. |
CommandNotRegistered | The subcommand hasn't been registered in a Commander instance. |
|
inline |
A Subcommand is initialized with a name, the number of arguments it requires, and a function to run.
name | The subcommand name; this is the name that will select this command. |
argc | The minimum number of arguments required by this subcommand. |
func | A valid CommanderFunc. |
|
inline |
Name returns the name of this subcommand.
Status scsl::Subcommand::Run | ( | std::vector< std::string > | args | ) |
Run attempts to run the CommanderFunc for this subcommand.
args | The argument list. |