|
ChainCLI
A modern C++20 command-line interface library
|
Untemplated Base class for positional arguments in the CLI. Used to store all positional arguments in a single container. More...
#include <positional_argument.h>
Public Member Functions | |
| PositionalArgumentBase (std::string_view name, std::string_view optionsComment, bool repeatable, bool required, std::type_index t) | |
| Construct a new Positional 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. | |
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. | |
Additional Inherited Members | |
Protected Member Functions inherited from cli::commands::TypedArgumentBase | |
| TypedArgumentBase (std::type_index t) | |
Protected Member Functions inherited from cli::commands::ArgumentBase | |
| ArgumentBase (std::string_view name, std::string_view optionsComment, ArgumentKind argType, bool repeatable, bool required) | |
Protected Attributes inherited from cli::commands::TypedArgumentBase | |
| const std::type_index | type |
Protected Attributes inherited from cli::commands::ArgumentBase | |
| const std::string | name |
| std::string | optionsComment |
| const ArgumentKind | argType |
| bool | repeatable {false} |
| bool | required {true} |
Untemplated Base class for positional arguments in the CLI. Used to store all positional arguments in a single container.
|
inline |
Construct a new Positional Argument object.
| name | The name of the argument. |
| 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. |
|
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, ...).
| writer | The documentation writer to use. |
Implements cli::commands::ArgumentBase.
|
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.
| writer | The documentation writer to use. |
Implements cli::commands::ArgumentBase.