Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clihelp

The colored --help renderer shared by the fast* utils, extracted after all of them independently reinvented the same Row/Section/paint help page.

Usage

use clihelp::{ColorWhen, HelpPage, Row, Section};

let page = HelpPage::new("fasthex 0.3.0 - a very fast hex dumper")
    .usage("fasthex [options] [file]...")
    .usage("fasthex -r [options] [file] [-j <offset>]")
    .blurb("Multiple files are concatenated and treated as one stream.")
    .section(Section::with_note(
        "OUTPUT FORMAT",
        "Rule: lowercase = one-byte mode, UPPERCASE = two-byte mode.",
        vec![
            Row::new("", "(default)", "canonical hex + ASCII display"),
            Row::new("-x", "--hex", "one-byte hexadecimal display"),
        ],
    ))
    .section(Section::new(
        "LAYOUT",
        vec![Row::with_value("-W", "--width", "<N>", "bytes per row (default: 16)")],
    ));

page.print(ColorWhen::Auto);

ColorWhen also resolves the -L/--color <auto|always|never> flag pattern shared by these tools:

let color = clihelp::ColorWhen::parse(&flag_value)?.resolve();

For output that doesn't fit the flag-table model, free-form prose sections, or coloring numbers outside the help page entirely; clihelp::header() and clihelp::paint() expose the same palette directly.

Install

[dependencies]
clihelp = "0.1"

License

GPL-3.0-or-later, matching the tools that use it.

About

clihelp — the colored --help renderer for the fast* utils

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages