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

Holds the Opts, parses argc/argv, and renders the help. More...

#include <fe/cli.h>

Public Member Functions

 Cli ()=default
 Cli (std::string prog, std::string descr={})
Cliadd (Opt o)
std::optional< std::string > parse (int argc, const char *const *argv)
 Parses argc/argv; returns the error message - and nothing at all if all went well.
void help (std::ostream &) const
 Renders the help for a terminal.
void markdown (std::ostream &) const
 Renders the same information as Doxygen-flavored Markdown tables.
Add Option, Group, Section, or Epilog
Cliadd (Group g)
Clioperator| (Opt o) &
Clioperator| (Group g) &
Cli && operator| (Opt o) &&
Cli && operator| (Group g) &&
Clisection (std::string title, std::string head, std::vector< std::pair< std::string, std::string > > rows)
 A titled table of term/description rows that are not Opts - ENVIRONMENT, plugin arguments, ... Both backends render it below the options; head names the first column in Cli::markdown.
Cliepilog (std::string s)
 Text printed below the option list.

Friends

std::ostream & operator<< (std::ostream &os, const Cli &cli)

Detailed Description

Holds the Opts, parses argc/argv, and renders the help.

Definition at line 196 of file cli.h.

Constructor & Destructor Documentation

◆ Cli() [1/2]

fe::cli::Cli::Cli ( )
default

◆ Cli() [2/2]

fe::cli::Cli::Cli ( std::string prog,
std::string descr = {} )
inline

Definition at line 199 of file cli.h.

Member Function Documentation

◆ add() [1/2]

Cli & fe::cli::Cli::add ( Group g)
inline

Definition at line 211 of file cli.h.

References Cli(), and fe::cli::Group::name.

◆ add() [2/2]

Cli & fe::cli::Cli::add ( Opt o)
inline

Definition at line 203 of file cli.h.

References Cli().

Referenced by operator|(), operator|(), operator|(), and operator|().

◆ epilog()

Cli & fe::cli::Cli::epilog ( std::string s)
inline

Text printed below the option list.

Definition at line 225 of file cli.h.

References Cli().

◆ help()

void fe::cli::Cli::help ( std::ostream & ) const

Renders the help for a terminal.

◆ markdown()

void fe::cli::Cli::markdown ( std::ostream & ) const

Renders the same information as Doxygen-flavored Markdown tables.

◆ operator|() [1/4]

Cli & fe::cli::Cli::operator| ( Group g) &
inline

Definition at line 213 of file cli.h.

References add(), and Cli().

◆ operator|() [2/4]

Cli && fe::cli::Cli::operator| ( Group g) &&
inline

Definition at line 215 of file cli.h.

References add(), and Cli().

◆ operator|() [3/4]

Cli & fe::cli::Cli::operator| ( Opt o) &
inline

Definition at line 212 of file cli.h.

References add(), and Cli().

◆ operator|() [4/4]

Cli && fe::cli::Cli::operator| ( Opt o) &&
inline

Definition at line 214 of file cli.h.

References add(), and Cli().

◆ parse()

std::optional< std::string > fe::cli::Cli::parse ( int argc,
const char *const * argv )

Parses argc/argv; returns the error message - and nothing at all if all went well.

◆ section()

Cli & fe::cli::Cli::section ( std::string title,
std::string head,
std::vector< std::pair< std::string, std::string > > rows )
inline

A titled table of term/description rows that are not Opts - ENVIRONMENT, plugin arguments, ... Both backends render it below the options; head names the first column in Cli::markdown.

Pass no rows to get a bare header that groups the Sections below it - one level up in Cli::markdown.

Definition at line 220 of file cli.h.

References Cli().

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const Cli & cli )
friend

Definition at line 250 of file cli.h.

References Cli().


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