Represents a flag argument in the CLI.
More...
#include <flag_argument.h>
Represents a flag argument in the CLI.
◆ FlagArgument()
| cli::commands::FlagArgument::FlagArgument |
( |
std::string_view |
name, |
|
|
std::string_view |
shortName = "", |
|
|
std::string_view |
optionsComment = "", |
|
|
bool |
isRequired = false |
|
) |
| |
|
inlineexplicit |
Construct a new Flag Argument object.
- Parameters
-
| name | The name of the argument (usually starts with "--"). |
| shortName | The short name of the argument (usually starts with "-"). |
| optionsComment | A comment describing this argument. |
| isRequired | Whether the argument is required. |
◆ getArgDocString()
| inline_t std::string cli::commands::FlagArgument::getArgDocString |
( |
const docwriting::DocWriter & |
writer | ) |
const |
|
overridevirtual |
Get the argument documentation string for the argument.
This string is used in the Usage section of the help message for a command and displays a textual representation of the arguments attributes (e.g. if it is required or repeatable, ...).
- Parameters
-
| writer | The documentation writer to use. |
- Returns
- The argument documentation string for the argument.
Implements cli::commands::ArgumentBase.
◆ getOptionsDocString()
| inline_t std::string cli::commands::FlagArgument::getOptionsDocString |
( |
const docwriting::DocWriter & |
writer | ) |
const |
|
overridevirtual |
Get the options documentation string for the argument.
This string is used in the Options section of the help message for a command, where each argument is listed with its description.
- Parameters
-
| writer | The documentation writer to use. |
- Returns
- The options documentation string for the argument.
Implements cli::commands::ArgumentBase.
◆ withOptionsComment()
| FlagArgument & cli::commands::FlagArgument::withOptionsComment |
( |
std::string_view |
comment | ) |
|
|
inline |
Set the options comment for the argument.
The options comment is a brief description of the argument's purpose, used in help messages and documentation.
- Parameters
-
| comment | The options comment to set. |
- Returns
- A reference to this argument.
◆ withRequired()
| FlagArgument & cli::commands::FlagArgument::withRequired |
( |
bool |
req | ) |
|
|
inline |
Set whether the argument is required.
- Parameters
-
| req | Whether the argument should be required. |
- Returns
- A reference to this argument.
◆ withShortName()
| FlagArgument & cli::commands::FlagArgument::withShortName |
( |
std::string_view |
name | ) |
|
|
inline |
Set the short name for the argument.
The short name is a single-character alias for the argument, usually prefixed with a single dash (e.g., "-h" for "--help").
- Parameters
-
| name | The short name to set. |
- Returns
- A reference to this argument.
The documentation for this class was generated from the following files:
- src/chaincli/commands/flag_argument.h
- src/chaincli/commands/flag_argument.cpp