Untemplated base class for option arguments in the CLI. Used to store all option arguments in a single container.
More...
#include <option_argument.h>
|
| | OptionArgumentBase (std::string_view name, std::string_view optionsComment, bool repeatable, bool required, std::type_index t, std::string_view shortName, std::string_view valueName) |
| | Construct a new Option Argument object.
|
| |
| std::string | getOptionsDocString (const docwriting::DocWriter &writer) const override |
| | Get the options documentation string for the argument.
|
| |
| std::string | getArgDocString (const docwriting::DocWriter &writer) const override |
| | Get the argument documentation string for the argument.
|
| |
|
constexpr std::string_view | getValueName () const noexcept |
| |
Public Member Functions inherited from cli::commands::TypedArgumentBase |
| std::type_index | getType () const |
| | Get the type of the argument.
|
| |
| virtual std::any | parseToValue (const std::string &input) const =0 |
| | Parse the input string to the argument's value type.
|
| |
Public Member Functions inherited from cli::commands::ArgumentBase |
| constexpr std::string_view | getName () const noexcept |
| | Get the name of the argument.
|
| |
| constexpr std::string_view | getOptionComment () const noexcept |
| | Get the option comment for the argument.
|
| |
| constexpr bool | isRequired () const noexcept |
| | Check if the argument is required.
|
| |
| constexpr bool | isRepeatable () const noexcept |
| | Check if the argument is repeatable.
|
| |
| constexpr ArgumentKind | getArgType () const |
| | Get the type of the argument.
|
| |
Public Member Functions inherited from cli::commands::FlaggedArgumentBase |
| constexpr std::string_view | getShortName () const noexcept |
| | Get the short name of the argument.
|
| |
Untemplated base class for option arguments in the CLI. Used to store all option arguments in a single container.
◆ OptionArgumentBase()
| cli::commands::OptionArgumentBase::OptionArgumentBase |
( |
std::string_view |
name, |
|
|
std::string_view |
optionsComment, |
|
|
bool |
repeatable, |
|
|
bool |
required, |
|
|
std::type_index |
t, |
|
|
std::string_view |
shortName, |
|
|
std::string_view |
valueName |
|
) |
| |
|
inline |
Construct a new Option Argument object.
- Parameters
-
| name | The name of the argument (usually starts with "--"). |
| optionsComment | A comment describing this argument. |
| repeatable | Whether the argument can be specified multiple times. |
| required | Whether the argument is required. |
| t | The type of the argument's value. |
| shortName | The short name for the argument (usually starts with "-"). |
| valueName | The name of the value for the argument. |
◆ getArgDocString()
| inline_t std::string cli::commands::OptionArgumentBase::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::OptionArgumentBase::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.
The documentation for this class was generated from the following files: