CLI11
C++11 Command Line Interface Parser
Public Member Functions | List of all members
CLI::Formatter Class Reference

#include <FormatterFwd.hpp>

Inheritance diagram for CLI::Formatter:
CLI::FormatterBase

Public Member Functions

 Formatter (const Formatter &)=default
 
 Formatter (Formatter &&)=default
 
Overridables
virtual std::string make_group (std::string group, bool is_positional, std::vector< const Option * > opts) const
 
virtual std::string make_positionals (const App *app) const
 This prints out just the positionals "group".
 
std::string make_groups (const App *app, AppFormatMode mode) const
 This prints out all the groups of options.
 
virtual std::string make_subcommands (const App *app, AppFormatMode mode) const
 This prints out all the subcommands.
 
virtual std::string make_subcommand (const App *sub) const
 This prints out a subcommand.
 
virtual std::string make_expanded (const App *sub) const
 This prints out a subcommand in help-all.
 
virtual std::string make_footer (const App *app) const
 This prints out all the groups of options.
 
virtual std::string make_description (const App *app) const
 This displays the description line.
 
virtual std::string make_usage (const App *app, std::string name) const
 This displays the usage line.
 
std::string make_help (const App *, std::string, AppFormatMode) const override
 This puts everything together.
 
Options
virtual std::string make_option (const Option *opt, bool is_positional) const
 This prints out an option help line, either positional or optional form.
 
virtual std::string make_option_name (const Option *, bool) const
 This is the name part of an option, Default: left column.
 
virtual std::string make_option_opts (const Option *) const
 This is the options part of the name, Default: combined into left column.
 
virtual std::string make_option_desc (const Option *) const
 This is the description. Default: Right column, on new line if left column too large.
 
virtual std::string make_option_usage (const Option *opt) const
 This is used to print the name on the USAGE line.
 
- Public Member Functions inherited from CLI::FormatterBase
 FormatterBase ()=default
 
 FormatterBase (const FormatterBase &)=default
 
 FormatterBase (FormatterBase &&)=default
 
virtual ~FormatterBase () noexcept
 Adding a destructor in this form to work around bug in GCC 4.7.
 
void label (std::string key, std::string val)
 Set the "REQUIRED" label.
 
void column_width (std::size_t val)
 Set the column width.
 
std::string get_label (std::string key) const
 Get the current value of a name (REQUIRED, etc.)
 
std::size_t get_column_width () const
 Get the current column width.
 

Additional Inherited Members

- Protected Attributes inherited from CLI::FormatterBase
std::size_t column_width_ {30}
 The width of the first column.
 
std::map< std::string, std::string > labels_ {}
 The required help printout labels (user changeable) Values are Needs, Excludes, etc.
 

Detailed Description

This is the default Formatter for CLI11. It pretty prints help output, and is broken into quite a few overridable methods, to be highly customizable with minimal effort.

Member Function Documentation

◆ make_group()

std::string CLI::Formatter::make_group ( std::string  group,
bool  is_positional,
std::vector< const Option * >  opts 
) const
inlinevirtual

This prints out a group of options with title


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