FE 0.13.1
Header-only C++ frontend library
Loading...
Searching...
No Matches
fe::cli::Opt Class Reference

One option or positional argument; build one with fe::cli::opt, fe::cli::arg, or fe::cli::help. More...

#include <fe/cli.h>

Public Member Functions

Optoperator[] (std::string name)
 Adds name - "-o" for a short, "--output" for a long one.
Optoperator() (std::string descr)
 Sets the description shown in the help.
Optcardinality (size_t min, size_t max)
 This Opt must occur at least min and at most max times.

Friends

class Cli
template<class T>
Opt opt (T &target)
 A flag: sets target to true - or invokes it with true - each time it occurs.
template<class T>
Opt opt (T &target, std::string hint)
 An option that takes a value; hint names it in the help as <hint>.
template<class T>
Opt arg (T &target, std::string hint)
 A positional argument; hint names it in the help as <hint>.

Detailed Description

One option or positional argument; build one with fe::cli::opt, fe::cli::arg, or fe::cli::help.

Definition at line 121 of file cli.h.

Member Function Documentation

◆ cardinality()

Opt & fe::cli::Opt::cardinality ( size_t min,
size_t max )
inline

This Opt must occur at least min and at most max times.

Definition at line 130 of file cli.h.

◆ operator()()

Opt & fe::cli::Opt::operator() ( std::string descr)
inline

Sets the description shown in the help.

Definition at line 127 of file cli.h.

◆ operator[]()

Opt & fe::cli::Opt::operator[] ( std::string name)
inline

Adds name - "-o" for a short, "--output" for a long one.

Definition at line 124 of file cli.h.

◆ arg

template<class T>
Opt arg ( T & target,
std::string hint )
friend

A positional argument; hint names it in the help as <hint>.

Bind a std::vector to soak up all remaining ones.

Definition at line 186 of file cli.h.

References arg, and opt.

Referenced by arg, and Cli.

◆ Cli

friend class Cli
friend

Definition at line 150 of file cli.h.

References arg, Cli, and opt.

Referenced by Cli.

◆ opt [1/2]

template<class T>
Opt opt ( T & target)
friend

A flag: sets target to true - or invokes it with true - each time it occurs.

Definition at line 159 of file cli.h.

References opt.

Referenced by arg, Cli, opt, and opt.

◆ opt [2/2]

template<class T>
Opt opt ( T & target,
std::string hint )
friend

An option that takes a value; hint names it in the help as <hint>.

Definition at line 173 of file cli.h.

References opt.


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