|
cli11
|
Layout settings and labels shared by every formatter. More...
Public Member Functions | |
Basics | |
| 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 |
| virtual auto | make_help (const app_t *app, std::string name, app_format_mode_t mode) const -> std::string=0 |
| Assembles a complete help page. | |
Setters | |
| 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. | |
Getters | |
| 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. | |
Options | |
| 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. | |
| static auto | default_label (std::string_view key) -> std::string |
| The label used when no override is set. | |
Layout settings and labels shared by every formatter.
|
inline |
Sets the width of the left column.
| val | The new width, in characters. |
|
inlinestaticnodiscardprotected |
The label used when no override is set.
| key | The label to resolve. |
key unchanged.
|
inline |
Sets the width of the description paragraph.
| val | The new width, in characters. |
|
inline |
Enables or disables printing of default flag values.
| value | Whether to print default flag values. |
|
inline |
Enables or disables reflowing of the description paragraph.
| value | Whether to reflow. |
|
inline |
Enables or disables reflowing of the footer paragraph.
| value | Whether to reflow. |
|
inline |
Enables or disables printing of option default values.
| value | Whether to print defaults. |
|
inline |
Enables or disables printing of option type names.
| value | Whether to print type names. |
|
inline |
Sets the width of the footer paragraph.
| val | The new width, in characters. |
|
inlinenodiscard |
Returns the width of the left column.
|
inlinenodiscard |
Returns the width of the description paragraph.
|
inlinenodiscard |
Returns the width of the footer paragraph.
|
inlinenodiscard |
Resolves a section label, applying any override.
| key | The label to resolve. |
key unchanged.
|
inlinenodiscard |
Returns the alignment ratio for long options.
|
inlinenodiscard |
Returns the width of the right column.
|
inlinenodiscard |
Reports whether default flag values are printed.
|
inlinenodiscard |
Reports whether the description paragraph is reflowed.
|
inlinenodiscard |
Reports whether the footer paragraph is reflowed.
|
inlinenodiscard |
Reports whether option default values are printed.
|
inlinenodiscard |
Reports whether option type names are printed.
|
inline |
Overrides a section label.
| key | The label to override. |
| val | The replacement text. |
|
inline |
Sets the alignment ratio for long options in the left column.
Values outside [0, 1] are folded back into range.
| ratio | The new ratio. |
|
nodiscardpure virtual |
Assembles a complete help page.
| app | The application to describe. |
| name | The name to present the application under. |
| mode | How much detail to include. |
Implemented in cli::formatter_lambda_t, and cli::formatter_t.
|
inline |
Sets the width of the right column.
| val | The new width, in characters. |
|
protected |
User overrides for the section labels.
Uses a transparent comparator so lookups accept std::string_view without allocating.