cli20 0.1.2
A C++20 typed-schema command-line parser
Loading...
Searching...
No Matches
cli::pack Namespace Reference

Terminal actions that write the converted (and validated) value into argument storage. More...

Classes

struct  SetTrue
 Sets the bool storage to true. More...
struct  SetFalse
 Sets the bool storage to false. More...
struct  Toggle
 Flips the bool storage each time the option is seen. More...
struct  Increment
 Increments a std::size_t counter each time the option is seen. More...
struct  RejectDuplicate
 Passes the value through unchanged, but returns ErrorCode::duplicate_argument if the option has been seen more than once. More...
struct  SetOnce
 Stores the input value and rejects subsequent occurrences. More...
struct  PushUnique
 Appends the value to a std::vector<T>, rejecting duplicate values. More...
struct  Push
 Appends the value to a std::vector<T>. More...
struct  Insert
 Inserts the value into a std::set<T> (duplicates are silently ignored by the set). More...
struct  InsertOrAssign
struct  Extend
struct  MarkPresent
 Sets a bool flag to true when the option is seen, regardless of value. More...
struct  StoreInto
 Writes the value directly into an external variable via a T* pointer. More...
struct  Callback
 Invokes a compile-time callable Fn with the parsed value as a terminal action. More...

Concepts

concept  CallbackInvocable

Variables

constexpr auto set_true = Action<SetTrue{}>{}
constexpr auto set_false = Action<SetFalse{}>{}
constexpr auto toggle = Action<Toggle{}>{}
constexpr auto increment = Action<Increment{}>{}
constexpr auto set_once = Action<SetOnce{}>{}
constexpr auto reject_duplicate = Action<RejectDuplicate{}>{}
constexpr auto push_unique = Action<PushUnique{}>{}
constexpr auto push = Action<Push{}>{}
constexpr auto insert = Action<Insert{}>{}
constexpr auto insert_or_assign = Action<InsertOrAssign{}>{}
constexpr auto mark_present = Action<MarkPresent{}>{}
template<auto Fn>
constexpr auto callback = Action<Callback<Fn>{}>{}
template<class T>
constexpr auto write_to = Action<StoreInto<T>{}>{}

Detailed Description

Terminal actions that write the converted (and validated) value into argument storage.

Pack actions are always the last step in an action pipeline. They define the storage_type alias that determines the type of the field's .value() member.

Example:

constexpr auto my_action = cli::conversion::integer<int> | cli::pack::push;
constexpr auto integer
Definition action.hh:921
constexpr auto push
Definition action.hh:1880

Variable Documentation

◆ callback

template<auto Fn>
auto cli::pack::callback = Action<Callback<Fn>{}>{}
inlineconstexpr

Definition at line 1886 of file action.hh.

◆ increment

auto cli::pack::increment = Action<Increment{}>{}
inlineconstexpr

Definition at line 1876 of file action.hh.

◆ insert

auto cli::pack::insert = Action<Insert{}>{}
inlineconstexpr

Definition at line 1881 of file action.hh.

◆ insert_or_assign

auto cli::pack::insert_or_assign = Action<InsertOrAssign{}>{}
inlineconstexpr

Definition at line 1882 of file action.hh.

◆ mark_present

auto cli::pack::mark_present = Action<MarkPresent{}>{}
inlineconstexpr

Definition at line 1884 of file action.hh.

◆ push

auto cli::pack::push = Action<Push{}>{}
inlineconstexpr

Definition at line 1880 of file action.hh.

◆ push_unique

auto cli::pack::push_unique = Action<PushUnique{}>{}
inlineconstexpr

Definition at line 1879 of file action.hh.

◆ reject_duplicate

auto cli::pack::reject_duplicate = Action<RejectDuplicate{}>{}
inlineconstexpr

Definition at line 1878 of file action.hh.

◆ set_false

auto cli::pack::set_false = Action<SetFalse{}>{}
inlineconstexpr

Definition at line 1874 of file action.hh.

◆ set_once

auto cli::pack::set_once = Action<SetOnce{}>{}
inlineconstexpr

Definition at line 1877 of file action.hh.

◆ set_true

auto cli::pack::set_true = Action<SetTrue{}>{}
inlineconstexpr

Definition at line 1873 of file action.hh.

◆ toggle

auto cli::pack::toggle = Action<Toggle{}>{}
inlineconstexpr

Definition at line 1875 of file action.hh.

◆ write_to

template<class T>
auto cli::pack::write_to = Action<StoreInto<T>{}>{}
inlineconstexpr

Definition at line 1888 of file action.hh.