Defines a command.
More...
#include <tools/nfdc/command-definition.hpp>
Defines a command.
Definition at line 131 of file command-definition.hpp.
◆ CommandDefinition()
nfd::tools::nfdc::CommandDefinition::CommandDefinition |
( |
std::string_view |
noun, |
|
|
std::string_view |
verb |
|
) |
| |
◆ ~CommandDefinition()
nfd::tools::nfdc::CommandDefinition::~CommandDefinition |
( |
| ) |
|
|
default |
◆ addArg()
Declare an argument.
- Parameters
-
name | argument name, must be unique |
valueType | argument value type |
isRequired | whether the argument is required |
allowPositional | whether the argument value can be specified as positional |
metavar | displayed argument value placeholder |
Definition at line 108 of file command-definition.cpp.
◆ getNoun()
const std::string& nfd::tools::nfdc::CommandDefinition::getNoun |
( |
| ) |
const |
|
inline |
◆ getTitle()
const std::string& nfd::tools::nfdc::CommandDefinition::getTitle |
( |
| ) |
const |
|
inline |
◆ getVerb()
const std::string& nfd::tools::nfdc::CommandDefinition::getVerb |
( |
| ) |
const |
|
inline |
◆ parse()
CommandArguments nfd::tools::nfdc::CommandDefinition::parse |
( |
const std::vector< std::string > & |
tokens, |
|
|
size_t |
start = 0 |
|
) |
| const |
Parse a command line.
- Parameters
-
tokens | command line tokens |
start | command line start position, after noun and verb |
- Exceptions
-
Error | command line is invalid |
Definition at line 133 of file command-definition.cpp.
◆ setTitle()
CommandDefinition& nfd::tools::nfdc::CommandDefinition::setTitle |
( |
std::string_view |
title | ) |
|
|
inline |
Set one-line description.
- Parameters
-
title | one-line description, written in lower case |
Definition at line 169 of file command-definition.hpp.