Skip to content
Myr

Merge pull request #841 from starsep/colorful-help

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Add colors to --help/-h

authored by David Peter · committed by GitHub · parents 87f3905, bb834ca · Browse files · 1 file+11 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−2 removed

  • other:+11 added−2 removed

1 file+11 added−2 removed

modified:src/cli.rs+11 added-2 removed
1use std::ffi::OsString;23use clap::{4 builder::NonEmptyStringValueParser, crate_version, Arg, ArgAction, ArgMatches, Command,5 ValueHint,4 builder::styling::{AnsiColor, Effects},5 builder::NonEmptyStringValueParser,6 builder::Styles,7 crate_version, Arg, ArgAction, ArgMatches, Command, ValueHint,8};910pub fn get_cli_arguments<'a, I, T>(args: I) -> ArgMatches11where
3 unmodified lines
15 let command = build_command();16 command.get_matches_from(args)17}1819const STYLES: Styles = Styles::styled()20 .header(AnsiColor::Green.on_default().effects(Effects::BOLD))21 .usage(AnsiColor::Green.on_default().effects(Effects::BOLD))22 .literal(AnsiColor::Cyan.on_default().effects(Effects::BOLD))23 .placeholder(AnsiColor::Cyan.on_default());2425/// Build the clap command for parsing command line arguments26fn build_command() -> Command {27 Command::new("hyperfine")28 .version(crate_version!())29 .styles(STYLES)30 .next_line_help(true)31 .hide_possible_values(true)32 .about("A command-line benchmarking tool.")33 .help_expected(true)
399 unmodified lines