|
cli20 0.1.2
A C++20 typed-schema command-line parser
|
Post-parse constraint helpers. More...
Functions | |
| template<detail::NamedProviderArg... Args> | |
| auto | one_of (const Args &... args) -> ConstraintResult |
| Exactly one of the listed options must be provided. | |
| template<detail::NamedProviderArg... Args> | |
| auto | at_most_one_of (const Args &... args) -> ConstraintResult |
| At most one of the listed options may be provided. | |
| template<detail::NamedProviderArg... Args> | |
| auto | all_of (const Args &... args) -> ConstraintResult |
| All of the listed options must be provided. | |
| template<detail::NamedProviderArg... Args> | |
| auto | all_or_none (const Args &... args) -> ConstraintResult |
| Either all of the listed options must be provided, or none. | |
| template<detail::NamedProviderArg Cond, detail::NamedProviderArg Req> | |
| auto | requires_if (const Cond &condition, const Req &required) -> ConstraintResult |
| If condition is provided, required must also be provided. | |
Post-parse constraint helpers.
Each function checks a relationship between options and returns a ConstraintResult. Combine results with && or ||:
| auto cli::constraint::all_of | ( | const Args &... | args | ) | -> ConstraintResult |
All of the listed options must be provided.
Returns missing_required listing all names if any are absent.
Definition at line 137 of file constraint.hh.
| auto cli::constraint::all_or_none | ( | const Args &... | args | ) | -> ConstraintResult |
Either all of the listed options must be provided, or none.
Returns dependency_missing when some but not all are present.
Definition at line 154 of file constraint.hh.
| auto cli::constraint::at_most_one_of | ( | const Args &... | args | ) | -> ConstraintResult |
At most one of the listed options may be provided.
Returns mutually_exclusive if two or more are present simultaneously.
Definition at line 120 of file constraint.hh.
| auto cli::constraint::one_of | ( | const Args &... | args | ) | -> ConstraintResult |
Exactly one of the listed options must be provided.
Returns validation_failed / mutually_exclusive with a message listing all option names when the count is 0 or ≥ 2.
Definition at line 93 of file constraint.hh.
| auto cli::constraint::requires_if | ( | const Cond & | condition, |
| const Req & | required ) -> ConstraintResult |
If condition is provided, required must also be provided.
Returns dependency_missing naming the missing option when the condition holds but the dependency is absent.
Definition at line 173 of file constraint.hh.