cli20 0.1.2
A C++20 typed-schema command-line parser
Loading...
Searching...
No Matches
argument.hh File Reference
#include <algorithm>
#include <filesystem>
#include <functional>
#include <optional>
#include <string>
#include <string_view>
#include <type_traits>
#include <vector>
#include "cli/action.hh"
#include "cli/argument_base.hh"
#include "cli/argument_validation.hh"
#include "cli/meta.hh"
#include "cli/relation.hh"
#include "cli/string_literal.hh"

Go to the source code of this file.

Classes

struct  cli::ArgParameter< T >
 Parameter bag used when constructing ArgImpl or PositionalImpl with named fields. More...
struct  cli::PositionalImpl< N, A >
struct  cli::Description
 A DescriptionTag field that carries the top-level CLI description. More...
struct  cli::CommandParameter
 Parameter bag used when constructing a Command field. More...
struct  cli::Command< Name, T >
 A named subcommand that nests another argument specification. More...

Namespaces

namespace  cli

Concepts

concept  cli::ArgumentSpec
 Concept that validates an aggregate type as a well-formed CLI argument specification.

Typedefs

template<StringLiteral Name, auto... Args>
using cli::Arg = typename detail::ArgAlias<Name, Args...>::type
 Defines a typed command-line argument specification.
template<StringLiteral Name, char ShortName = '\0'>
using cli::Flag = Arg<Name, ShortName, pack::set_true, nargs::none>
 A boolean flag option that stores true when present.
template<class T, StringLiteral Name, char ShortName = '\0'>
using cli::BoundOption = Arg<Name, ShortName, detail::ActionFor<T>::write_to>
 An option whose parsed value is written directly into an external variable.
template<StringLiteral Name, char ShortName = '\0'>
using cli::BoundStringOption = BoundOption<std::string, Name, ShortName>
 BoundOption specialisation for std::string.
template<StringLiteral Name, char ShortName = '\0'>
using cli::BoundIntOption = BoundOption<int, Name, ShortName>
 BoundOption specialisation for int.
template<StringLiteral Name, char ShortName = '\0'>
using cli::BoundDoubleOption = BoundOption<double, Name, ShortName>
 BoundOption specialisation for double.
template<StringLiteral Name, char ShortName = '\0'>
using cli::BoundPathOption = BoundOption<std::filesystem::path, Name, ShortName>
 BoundOption specialisation for std::filesystem::path.
template<StringLiteral Name = "help", char ShortName = 'h'>
using cli::Help
 A built-in help flag that prints help and exits with code 0.
template<class T, StringLiteral Name, char ShortName = '\0'>
using cli::Option = Arg<Name, ShortName, detail::ActionFor<T>::set_once>
 A single-value option that stores the parsed result in T.
template<class T, StringLiteral Name, char ShortName = '\0', Nargs N = nargs::one_or_more>
using cli::ListOption = Arg<Name, ShortName, detail::ActionFor<T>::push, N>
 A multi-value option that appends each occurrence to a std::vector<T>.
template<class T, Nargs N = nargs::one>
using cli::Positional = PositionalImpl<N, detail::PositionalActionFor<T, N>::value>
 A typed positional argument.
template<StringLiteral Name, char ShortName = '\0'>
using cli::StringOption = Option<std::string, Name, ShortName>
 Option<std::string, Name, ShortName>.
template<StringLiteral Name, char ShortName = '\0'>
using cli::IntOption = Option<int, Name, ShortName>
 Option<int, Name, ShortName>.
template<StringLiteral Name, char ShortName = '\0'>
using cli::DoubleOption = Option<double, Name, ShortName>
 Option<double, Name, ShortName>.
template<StringLiteral Name, char ShortName = '\0'>
using cli::PathOption = Option<std::filesystem::path, Name, ShortName>
 Option<std::filesystem::path, Name, ShortName>.