cli20 0.1.2
A C++20 typed-schema command-line parser
Loading...
Searching...
No Matches
cli::ActionCtx< T > Struct Template Reference

Context passed to each action function during pipeline execution. More...

#include <action.hh>

Public Attributes

size_t index {}
 Zero-based index into argv of the current token.
size_t occurrences {}
 Number of times the parent option token has appeared.
size_t nargs {}
 Number of values in this option occurrence.
size_t value_index {}
 0-based index of current value in this occurrence.
size_t total_values {}
 Total values across all occurrences of this option.
std::reference_wrapper< T > arg {}
 Reference to the argument's storage value.

Detailed Description

template<class T = void>
struct cli::ActionCtx< T >

Context passed to each action function during pipeline execution.

Provides access to the current argv position, how many times the parent option has been seen, how many values are in this occurrence, the 0-based index of the current value, the total values across all occurrences, and a reference to the argument's storage value.

Template Parameters
TThe storage type of the argument; void for intermediate (non-terminal) actions.

Definition at line 246 of file action.hh.

Member Data Documentation

◆ arg

template<class T = void>
std::reference_wrapper<T> cli::ActionCtx< T >::arg {}

Reference to the argument's storage value.

Definition at line 255 of file action.hh.

◆ index

template<class T = void>
size_t cli::ActionCtx< T >::index {}

Zero-based index into argv of the current token.

Definition at line 247 of file action.hh.

◆ nargs

template<class T = void>
size_t cli::ActionCtx< T >::nargs {}

Number of values in this option occurrence.

Definition at line 250 of file action.hh.

◆ occurrences

template<class T = void>
size_t cli::ActionCtx< T >::occurrences {}

Number of times the parent option token has appeared.

Definition at line 249 of file action.hh.

◆ total_values

template<class T = void>
size_t cli::ActionCtx< T >::total_values {}

Total values across all occurrences of this option.

Definition at line 253 of file action.hh.

◆ value_index

template<class T = void>
size_t cli::ActionCtx< T >::value_index {}

0-based index of current value in this occurrence.

Definition at line 251 of file action.hh.


The documentation for this struct was generated from the following file: