cli11
Loading...
Searching...
No Matches
cli::formatter_lambda_t Class Referencefinalexport
module cli11

A formatter that delegates the whole help page to a callable. More...

Inheritance diagram for cli::formatter_lambda_t:
cli::formatter_base_t

Public Member Functions

 formatter_lambda_t (funct_t funct)
 Wraps a callable as a formatter.
auto make_help (const app_t *app, std::string name, app_format_mode_t mode) const -> std::string override
 Renders the help page by invoking the wrapped callable.
Public Member Functions inherited from cli::formatter_base_t
 formatter_base_t (const formatter_base_t &)=default
 formatter_base_t (formatter_base_t &&)=default
auto operator= (const formatter_base_t &) -> formatter_base_t &=default
auto operator= (formatter_base_t &&) -> formatter_base_t &=default
auto label (std::string key, std::string val) -> void
 Overrides a section label.
auto column_width (std::size_t val) -> void
 Sets the width of the left column.
auto long_option_alignment_ratio (float ratio) -> void
 Sets the alignment ratio for long options in the left column.
auto right_column_width (std::size_t val) -> void
 Sets the width of the right column.
auto description_paragraph_width (std::size_t val) -> void
 Sets the width of the description paragraph.
auto footer_paragraph_width (std::size_t val) -> void
 Sets the width of the footer paragraph.
auto enable_description_formatting (bool value=true) -> void
 Enables or disables reflowing of the description paragraph.
auto enable_footer_formatting (bool value=true) -> void
 Enables or disables reflowing of the footer paragraph.
auto enable_option_defaults (bool value=true) -> void
 Enables or disables printing of option default values.
auto enable_option_type_names (bool value=true) -> void
 Enables or disables printing of option type names.
auto enable_default_flag_values (bool value=true) -> void
 Enables or disables printing of default flag values.
auto get_label (std::string_view key) const -> std::string
 Resolves a section label, applying any override.
auto get_column_width () const -> std::size_t
 Returns the width of the left column.
auto get_right_column_width () const -> std::size_t
 Returns the width of the right column.
auto get_description_paragraph_width () const -> std::size_t
 Returns the width of the description paragraph.
auto get_footer_paragraph_width () const -> std::size_t
 Returns the width of the footer paragraph.
auto get_long_option_alignment_ratio () const -> float
 Returns the alignment ratio for long options.
auto is_description_paragraph_formatting_enabled () const -> bool
 Reports whether the description paragraph is reflowed.
auto is_footer_paragraph_formatting_enabled () const -> bool
 Reports whether the footer paragraph is reflowed.
auto is_option_defaults_enabled () const -> bool
 Reports whether option default values are printed.
auto is_option_type_names_enabled () const -> bool
 Reports whether option type names are printed.
auto is_default_flag_values_enabled () const -> bool
 Reports whether default flag values are printed.

Additional Inherited Members

static auto default_label (std::string_view key) -> std::string
 The label used when no override is set.
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 (descriptions).
std::size_t description_paragraph_width_ {80}
 The width of the description paragraph at the top of the help.
std::size_t footer_paragraph_width_ {80}
 The width of the footer paragraph.
bool enable_description_formatting_ {true}
 Whether the description paragraph is reflowed.
bool enable_footer_formatting_ {true}
 Whether the footer paragraph is reflowed.
bool enable_option_defaults_ {true}
 Whether option default values are printed.
bool enable_option_type_names_ {true}
 Whether option type names are printed.
bool enable_default_flag_values_ {true}
 Whether default flag values are printed.
std::map< std::string, std::string, std::less<> > labels_ {}
 User overrides for the section labels.

Detailed Description

A formatter that delegates the whole help page to a callable.

Constructor & Destructor Documentation

◆ formatter_lambda_t()

cli::formatter_lambda_t::formatter_lambda_t ( funct_t funct)
inlineexplicit

Wraps a callable as a formatter.

Parameters
functThe callable that renders the help page.

Member Function Documentation

◆ make_help()

auto cli::formatter_lambda_t::make_help ( const app_t * app,
std::string name,
app_format_mode_t mode ) const -> std::string
inlinenodiscardoverridevirtual

Renders the help page by invoking the wrapped callable.

Parameters
appThe application to describe.
nameThe name to present the application under.
modeHow much detail to include.
Returns
The rendered help page.

Implements cli::formatter_base_t.


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