Highlight echoed recipe lines in bold by default (#512)

Make `--highlight`, which highlights echoed recipe lines in bold, the
default behavior. Add `--no-highlight` to activate the old behavior.
This commit is contained in:
Casey Rodarmor 2019-11-07 11:50:11 -08:00 committed by GitHub
parent 36aca2bf7a
commit 2ff33de5a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,6 +33,7 @@ mod arg {
pub(crate) const COLOR: &str = "COLOR"; pub(crate) const COLOR: &str = "COLOR";
pub(crate) const DRY_RUN: &str = "DRY-RUN"; pub(crate) const DRY_RUN: &str = "DRY-RUN";
pub(crate) const HIGHLIGHT: &str = "HIGHLIGHT"; pub(crate) const HIGHLIGHT: &str = "HIGHLIGHT";
pub(crate) const NO_HIGHLIGHT: &str = "NO-HIGHLIGHT";
pub(crate) const JUSTFILE: &str = "JUSTFILE"; pub(crate) const JUSTFILE: &str = "JUSTFILE";
pub(crate) const QUIET: &str = "QUIET"; pub(crate) const QUIET: &str = "QUIET";
pub(crate) const SET: &str = "SET"; pub(crate) const SET: &str = "SET";
@ -91,7 +92,14 @@ impl<'a> Config<'a> {
.arg( .arg(
Arg::with_name(arg::HIGHLIGHT) Arg::with_name(arg::HIGHLIGHT)
.long("highlight") .long("highlight")
.help("Highlight echoed recipe lines in bold"), .help("Highlight echoed recipe lines in bold")
.overrides_with(arg::NO_HIGHLIGHT),
)
.arg(
Arg::with_name(arg::NO_HIGHLIGHT)
.long("no-highlight")
.help("Don't highlight echoed recipe lines in bold")
.overrides_with(arg::HIGHLIGHT),
) )
.arg( .arg(
Arg::with_name(arg::JUSTFILE) Arg::with_name(arg::JUSTFILE)
@ -287,7 +295,7 @@ impl<'a> Config<'a> {
Ok(Config { Ok(Config {
dry_run: matches.is_present(arg::DRY_RUN), dry_run: matches.is_present(arg::DRY_RUN),
highlight: matches.is_present(arg::HIGHLIGHT), highlight: !matches.is_present(arg::NO_HIGHLIGHT),
quiet: matches.is_present(arg::QUIET), quiet: matches.is_present(arg::QUIET),
shell: matches.value_of(arg::SHELL).unwrap(), shell: matches.value_of(arg::SHELL).unwrap(),
justfile: matches.value_of(arg::JUSTFILE).map(Path::new), justfile: matches.value_of(arg::JUSTFILE).map(Path::new),
@ -346,6 +354,7 @@ FLAGS:
--evaluate Print evaluated variables --evaluate Print evaluated variables
--highlight Highlight echoed recipe lines in bold --highlight Highlight echoed recipe lines in bold
-l, --list List available recipes and their arguments -l, --list List available recipes and their arguments
--no-highlight Don't highlight echoed recipe lines in bold
-q, --quiet Suppress all output -q, --quiet Suppress all output
--summary List names of available recipes --summary List names of available recipes
-v, --verbose Use verbose output -v, --verbose Use verbose output