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

Injects a compile-time default value when an option is invoked as a flag (no value provided). More...

#include <action.hh>

Public Types

template<class Input>
using after_type = std::string_view
template<class Prev>
using storage_type = void

Public Member Functions

auto operator() (ActionCtx< void > ctx, ActionResult< std::optional< std::string_view > > input) const -> ActionResult< std::string_view >

Static Public Attributes

template<class Input>
static constexpr bool accepts_input

Detailed Description

template<StringLiteral Value>
struct cli::conversion::DefaultMissingValue< Value >

Injects a compile-time default value when an option is invoked as a flag (no value provided).

Accepts std::optional<std::string_view> as input:

  • If the optional has a value (actual value provided), unwrap and pass through.
  • If nullopt (flag-only invocation) and nargs == 0, inject the compile-time default string.
  • If nullopt but nargs > 0 (value coming separately), return ignore.
Template Parameters
ValueThe default string value to inject when invoked as a flag.

Definition at line 998 of file action.hh.

Member Typedef Documentation

◆ after_type

template<StringLiteral Value>
template<class Input>
using cli::conversion::DefaultMissingValue< Value >::after_type = std::string_view

Definition at line 1004 of file action.hh.

◆ storage_type

template<StringLiteral Value>
template<class Prev>
using cli::conversion::DefaultMissingValue< Value >::storage_type = void

Definition at line 1007 of file action.hh.

Member Function Documentation

◆ operator()()

template<StringLiteral Value>
auto cli::conversion::DefaultMissingValue< Value >::operator() ( ActionCtx< void > ctx,
ActionResult< std::optional< std::string_view > > input ) const -> ActionResult< std::string_view >
inline

Definition at line 1009 of file action.hh.

Member Data Documentation

◆ accepts_input

template<StringLiteral Value>
template<class Input>
bool cli::conversion::DefaultMissingValue< Value >::accepts_input
staticconstexpr
Initial value:
=
std::same_as<std::remove_cvref_t<Input>, std::optional<std::string_view>>

Definition at line 1000 of file action.hh.


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