Loading...
Searching...
No Matches
CLI::Formatter Class Reference

`#include <FormatterFwd.hpp>`

Inheritance diagram for CLI::Formatter:

## Public Member Functions

| Formatter ()=default
| Formatter (const Formatter &)=default
| Formatter (Formatter &&)=default
Formatter & | operator= (const Formatter &)=default
Formatter & | operator= (Formatter &&)=default
Overridables
virtual CLI11_NODISCARD 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, AppFormatMode mode) 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 *app, std::string, AppFormatMode mode) const override
| This puts everything together.
Options
virtual std::string | make_option (const Option *, bool) 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
FormatterBase & | operator= (const FormatterBase &)=default
FormatterBase & | operator= (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" or other labels.
void | column_width (std::size_t val)
| Set the left column width (options/flags/subcommands).
void | long_option_alignment_ratio (float ratio)
void | right_column_width (std::size_t val)
| Set the right column width (description of options/flags/subcommands).
void | description_paragraph_width (std::size_t val)
| Set the description paragraph width at the top of help.
void | footer_paragraph_width (std::size_t val)
| Set the footer paragraph width.
void | enable_description_formatting (bool value=true)
| enable formatting for description paragraph
void | enable_footer_formatting (bool value=true)
| disable formatting for footer paragraph
CLI11_NODISCARD std::string | get_label (std::string key) const
| Get the current value of a name (REQUIRED, etc.).
CLI11_NODISCARD std::size_t | get_column_width () const
| Get the current left column width (options/flags/subcommands).
CLI11_NODISCARD std::size_t | get_right_column_width () const
| Get the current right column width (description of options/flags/subcommands).
CLI11_NODISCARD std::size_t | get_description_paragraph_width () const
| Get the current description paragraph width at the top of help.
CLI11_NODISCARD std::size_t | get_footer_paragraph_width () const
| Get the current footer paragraph width.
CLI11_NODISCARD bool | is_description_paragraph_formatting_enabled () const
| Get the current status of description paragraph formatting.
CLI11_NODISCARD bool | is_footer_paragraph_formatting_enabled () const
| Get the current status of whether footer paragraph formatting is enabled.

## Additional Inherited Members

Protected Attributes inherited from CLI::FormatterBase
std::size_t | column_width_ {30}
| The width of the left column (options/flags/subcommands).
float | long_option_alignment_ratio_ {1 / 3.f}
| The alignment ratio for long options within the left column.
std::size_t | right_column_width_ {65}
| The width of the right column (description of options/flags/subcommands).
std::size_t | description_paragraph_width_ {80}
| The width of the description paragraph at the top of help.
std::size_t | footer_paragraph_width_ {80}
| The width of the footer paragraph.
bool | enable_description_formatting_ {true}
| options controlling formatting for footer and descriptions
bool | enable_footer_formatting_ {true}
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.

## Constructor & Destructor Documentation

## Formatter() [1/3]

CLI::Formatter::Formatter | ( |  | ) |

default

## Formatter() [2/3]

CLI::Formatter::Formatter | ( | const Formatter & |  | ) |

default

## Formatter() [3/3]

CLI::Formatter::Formatter | ( | Formatter && |  | ) |

default

## Member Function Documentation

## make_description()

virtual std::string CLI::Formatter::make_description | ( | const App * | app | ) | const

virtual

This displays the description line.

## make_expanded()

virtual std::string CLI::Formatter::make_expanded | ( | const App * | sub,
|  | AppFormatMode | mode ) const

virtual

This prints out a subcommand in help-all.

## make_footer()

virtual std::string CLI::Formatter::make_footer | ( | const App * | app | ) | const

virtual

This prints out all the groups of options.

## make_group()

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

virtual

This prints out a group of options with title

## make_groups()

std::string CLI::Formatter::make_groups | ( | const App * | app,
|  | AppFormatMode | mode ) const

This prints out all the groups of options.

## make_help()

std::string CLI::Formatter::make_help | ( | const App * | app,
|  | std::string | ,
|  | AppFormatMode | mode ) const

override virtual

This puts everything together.

Implements CLI::FormatterBase.

## make_option()

virtual std::string CLI::Formatter::make_option | ( | const Option * | ,
|  | bool | ) const

virtual

This prints out an option help line, either positional or optional form.

## make_option_desc()

virtual std::string CLI::Formatter::make_option_desc | ( | const Option * |  | ) | const

virtual

This is the description. Default: Right column, on new line if left column too large.

## make_option_name()

virtual std::string CLI::Formatter::make_option_name | ( | const Option * | ,
|  | bool | ) const

virtual

This is the name part of an option, Default: left column.

## make_option_opts()

virtual std::string CLI::Formatter::make_option_opts | ( | const Option * |  | ) | const

virtual

This is the options part of the name, Default: combined into left column.

## make_option_usage()

virtual std::string CLI::Formatter::make_option_usage | ( | const Option * | opt | ) | const

virtual

This is used to print the name on the USAGE line.

## make_positionals()

virtual std::string CLI::Formatter::make_positionals | ( | const App * | app | ) | const

virtual

This prints out just the positionals "group".

## make_subcommand()

virtual std::string CLI::Formatter::make_subcommand | ( | const App * | sub | ) | const

virtual

This prints out a subcommand.

## make_subcommands()

virtual std::string CLI::Formatter::make_subcommands | ( | const App * | app,
|  | AppFormatMode | mode ) const

virtual

This prints out all the subcommands.

## make_usage()

virtual std::string CLI::Formatter::make_usage | ( | const App * | app,
|  | std::string | name ) const

virtual

This displays the usage line.

## operator=() [1/2]

Formatter & CLI::Formatter::operator= | ( | const Formatter & |  | ) |

default

## operator=() [2/2]

Formatter & CLI::Formatter::operator= | ( | Formatter && |  | ) |

default

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

- include/CLI/FormatterFwd.hpp