|
ChainCLI
A modern C++20 command-line interface library
|
Base class for command-line arguments. More...
#include <argument.h>
Public Member Functions | |
| 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. | |
| virtual std::string | getOptionsDocString (const docwriting::DocWriter &writer) const =0 |
| Get the options documentation string for the argument. | |
| virtual std::string | getArgDocString (const docwriting::DocWriter &writer) const =0 |
| Get the argument documentation string for the argument. | |
Protected Member Functions | |
| ArgumentBase (std::string_view name, std::string_view optionsComment, ArgumentKind argType, bool repeatable, bool required) | |
Protected Attributes | |
| const std::string | name |
| std::string | optionsComment |
| const ArgumentKind | argType |
| bool | repeatable {false} |
| bool | required {true} |
Base class for command-line arguments.
|
pure virtual |
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. |
Implemented in cli::commands::FlagArgument, cli::commands::OptionArgumentBase, and cli::commands::PositionalArgumentBase.
|
inlineconstexpr |
Get the type of the argument.
|
inlineconstexprnoexcept |
Get the name of the argument.
The name is a unique identifier for the argument within its command.
|
inlineconstexprnoexcept |
Get the option comment for the argument.
The option comment is a brief description of the argument's purpose, used in help messages and documentation.
|
pure virtual |
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. |
Implemented in cli::commands::FlagArgument, cli::commands::OptionArgumentBase, and cli::commands::PositionalArgumentBase.
|
inlineconstexprnoexcept |
Check if the argument is repeatable.
|
inlineconstexprnoexcept |
Check if the argument is required.