25namespace cli::commands
37 template <
typename... Args>
38 requires((!std::same_as<std::remove_cvref_t<Args>,
ArgumentGroup> && ...) &&
39 (std::derived_from<std::remove_cvref_t<Args>,
ArgumentBase> && ...))
41 : exclusive(exclusive), inclusive(inclusive)
43 (arguments.emplace_back(
44 std::make_shared<std::remove_cvref_t<Args>>(std::forward<Args>(args))),
53 [[nodiscard]]
const std::vector<std::shared_ptr<ArgumentBase>> &
getArguments() const noexcept
62 [[nodiscard]]
bool isExclusive() const noexcept {
return exclusive; }
68 [[nodiscard]]
bool isInclusive() const noexcept {
return inclusive; }
78 void addArgument(
const std::shared_ptr<ArgumentBase> &arg) { arguments.push_back(arg); }
81 std::vector<std::shared_ptr<ArgumentBase>> arguments;
93 template <
typename... Args>
94 requires((!std::same_as<std::remove_cvref_t<Args>,
ExclusiveGroup> && ...) &&
95 (std::derived_from<std::remove_cvref_t<Args>,
ArgumentBase> && ...))
109 template <
typename... Args>
110 requires((!std::same_as<std::remove_cvref_t<Args>,
InclusiveGroup> && ...) &&
111 (std::derived_from<std::remove_cvref_t<Args>,
ArgumentBase> && ...))
Base class for command-line arguments.
Definition argument.h:41
Base class for command-line argument groups.
Definition argument_group.h:30
const std::vector< std::shared_ptr< ArgumentBase > > & getArguments() const noexcept
Get the arguments in the group.
Definition argument_group.h:53
bool isInclusive() const noexcept
Check if the group is inclusive.
Definition argument_group.h:68
bool isRequired() const
Check if this group is required.
Definition argument_group.cpp:23
void addArgument(const std::shared_ptr< ArgumentBase > &arg)
Add an argument to the group.
Definition argument_group.h:78
bool isExclusive() const noexcept
Check if the group is exclusive.
Definition argument_group.h:62
ArgumentGroup(bool exclusive, bool inclusive, Args &&...args)
Construct a new ArgumentGroup.
Definition argument_group.h:40
Exclusive argument group.
Definition argument_group.h:88
ExclusiveGroup(Args &&...args)
Construct a new ExclusiveGroup.
Definition argument_group.h:96
Inclusive argument group.
Definition argument_group.h:104
InclusiveGroup(Args &&...args)
Construct a new InclusiveGroup.
Definition argument_group.h:112