|
ChainCLI
A modern C++20 command-line interface library
|
Base class for command-line argument groups. More...
#include <argument_group.h>
Public Member Functions | |
| template<typename... Args> requires ((!std::same_as<std::remove_cvref_t<Args>, ArgumentGroup> && ...) && (std::derived_from<std::remove_cvref_t<Args>, ArgumentBase> && ...)) | |
| ArgumentGroup (bool exclusive, bool inclusive, Args &&...args) | |
| Construct a new ArgumentGroup. | |
| const std::vector< std::shared_ptr< ArgumentBase > > & | getArguments () const noexcept |
| Get the arguments in the group. | |
| bool | isExclusive () const noexcept |
| Check if the group is exclusive. | |
| bool | isInclusive () const noexcept |
| Check if the group is inclusive. | |
| bool | isRequired () const |
| Check if this group is required. | |
| void | addArgument (const std::shared_ptr< ArgumentBase > &arg) |
| Add an argument to the group. | |
Base class for command-line argument groups.
|
inlineexplicit |
Construct a new ArgumentGroup.
| ...Args | The types of the arguments to include in the group. |
| exclusive | Whether the group is exclusive. |
| inclusive | Whether the group is inclusive. |
| ...args | The arguments to include in the group. |
|
inline |
Add an argument to the group.
| arg | The argument to add. |
|
inlinenoexcept |
Get the arguments in the group.
The arguments are returned in the order they were added to the group.
|
inlinenoexcept |
Check if the group is exclusive.
An exclusive group means that only one argument in the group can be provided by the user.
|
inlinenoexcept |
Check if the group is inclusive.
An inclusive group means that at least one argument in the group must be provided by the user.
| inline_t bool cli::commands::ArgumentGroup::isRequired | ( | ) | const |
Check if this group is required.
A required group means that for exclusive groups, one of argument in the group must be provided, while for inclusive groups, all arguments must be provided.