mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-02 01:00:31 +00:00
Merge pull request #841 from starsep/colorful-help
Add colors to --help/-h
This commit is contained in:
1 file changed
+11
-2
+11
-2
@@ -1,8 +1,10 @@
|
|||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
|
|
||||||
use clap::{
|
use clap::{
|
||||||
builder::NonEmptyStringValueParser, crate_version, Arg, ArgAction, ArgMatches, Command,
|
builder::styling::{AnsiColor, Effects},
|
||||||
ValueHint,
|
builder::NonEmptyStringValueParser,
|
||||||
|
builder::Styles,
|
||||||
|
crate_version, Arg, ArgAction, ArgMatches, Command, ValueHint,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn get_cli_arguments<'a, I, T>(args: I) -> ArgMatches
|
pub fn get_cli_arguments<'a, I, T>(args: I) -> ArgMatches
|
||||||
@@ -14,10 +16,17 @@ where
|
|||||||
command.get_matches_from(args)
|
command.get_matches_from(args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const STYLES: Styles = Styles::styled()
|
||||||
|
.header(AnsiColor::Green.on_default().effects(Effects::BOLD))
|
||||||
|
.usage(AnsiColor::Green.on_default().effects(Effects::BOLD))
|
||||||
|
.literal(AnsiColor::Cyan.on_default().effects(Effects::BOLD))
|
||||||
|
.placeholder(AnsiColor::Cyan.on_default());
|
||||||
|
|
||||||
/// Build the clap command for parsing command line arguments
|
/// Build the clap command for parsing command line arguments
|
||||||
fn build_command() -> Command {
|
fn build_command() -> Command {
|
||||||
Command::new("hyperfine")
|
Command::new("hyperfine")
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
|
.styles(STYLES)
|
||||||
.next_line_help(true)
|
.next_line_help(true)
|
||||||
.hide_possible_values(true)
|
.hide_possible_values(true)
|
||||||
.about("A command-line benchmarking tool.")
|
.about("A command-line benchmarking tool.")
|
||||||
|
|||||||
Reference in new issue
Block a user