pub struct HelpPrinter;Expand description
Format help output for a schema. The result is ANSI-styled when the destination stream is a TTY and plain otherwise.
Implementations§
Source§impl HelpPrinter
impl HelpPrinter
Sourcepub fn format(schema: &CommandSchema) -> String
pub fn format(schema: &CommandSchema) -> String
Produce help text sized for stderr (color when stderr is a TTY).
Prefer HelpPrinter::print / HelpPrinter::print_error in
production; this method is primarily here for tests.
Sourcepub fn print(schema: &CommandSchema)
pub fn print(schema: &CommandSchema)
Print help text to stdout. Use this for user-requested help
(--help) so output can be piped or redirected normally. Color is
keyed off stdout, so redirected stdout is always plain.
Flushes stdout before returning so callers that process::exit
immediately afterwards still see all bytes land.
Sourcepub fn print_error(schema: &CommandSchema)
pub fn print_error(schema: &CommandSchema)
Print help text to stderr. Use this alongside an error message so both are grouped on the same stream.
Auto Trait Implementations§
impl Freeze for HelpPrinter
impl RefUnwindSafe for HelpPrinter
impl Send for HelpPrinter
impl Sync for HelpPrinter
impl Unpin for HelpPrinter
impl UnsafeUnpin for HelpPrinter
impl UnwindSafe for HelpPrinter
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