pub struct DefaultHelpFormatter;Expand description
Default help formatter — colored, aligned, English-only output.
Outputs English text to the terminal. If you need another language,
implement HelpFormatter and supply it via
CliBuilder::help_formatter().
Uses the colored crate for terminal output. Colours are applied
automatically and disabled when the terminal does not support them.
Column widths are computed dynamically so that descriptions are aligned regardless of command or argument name lengths.
§Example
use dynamic_cli::help::DefaultHelpFormatter;
let fmt = DefaultHelpFormatter::new();
// or equivalently:
let fmt = DefaultHelpFormatter::default();Implementations§
Trait Implementations§
Source§impl Debug for DefaultHelpFormatter
impl Debug for DefaultHelpFormatter
Source§impl Default for DefaultHelpFormatter
impl Default for DefaultHelpFormatter
Source§fn default() -> DefaultHelpFormatter
fn default() -> DefaultHelpFormatter
Returns the “default value” for a type. Read more
Source§impl HelpFormatter for DefaultHelpFormatter
impl HelpFormatter for DefaultHelpFormatter
Source§fn format_app(&self, config: &CommandsConfig) -> String
fn format_app(&self, config: &CommandsConfig) -> String
Format the application-level help (list of all commands).
§Output structure
myapp 1.0.0
USAGE:
myapp <command> [arguments] [options]
COMMANDS:
hello Say hello to someone
process Process data files
Run 'myapp --help <command>' for more information on a command.Source§fn format_command(&self, config: &CommandsConfig, command: &str) -> String
fn format_command(&self, config: &CommandsConfig, command: &str) -> String
Format help for a single command, looked up by name or alias.
§Output structure
hello — Say hello to someone
USAGE:
hello <name> [options]
ARGUMENTS:
name (string, required) Name to greet
OPTIONS:
-l, --loud (bool) Use uppercase
ALIASES:
hiIf the command is not found, returns a message listing available commands.
Auto Trait Implementations§
impl Freeze for DefaultHelpFormatter
impl RefUnwindSafe for DefaultHelpFormatter
impl Send for DefaultHelpFormatter
impl Sync for DefaultHelpFormatter
impl Unpin for DefaultHelpFormatter
impl UnsafeUnpin for DefaultHelpFormatter
impl UnwindSafe for DefaultHelpFormatter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more