mirror of
https://github.com/sharkdp/bat.git
synced 2025-02-22 04:48:48 +00:00
added additional alias for color=always when always-decorations flag is triggered
This commit is contained in:
parent
565a80305c
commit
fdf11326ef
@ -165,11 +165,14 @@ impl App {
|
|||||||
// There's no point in wrapping when this is the case.
|
// There's no point in wrapping when this is the case.
|
||||||
WrappingMode::NoWrapping
|
WrappingMode::NoWrapping
|
||||||
},
|
},
|
||||||
colored_output: match self.matches.value_of("color") {
|
colored_output: self.matches.is_present("always-decorations")
|
||||||
Some("always") => true,
|
|| match self.matches.value_of("color") {
|
||||||
Some("never") => false,
|
Some("always") => true,
|
||||||
Some("auto") | _ => env::var_os("NO_COLOR").is_none() && self.interactive_output,
|
Some("never") => false,
|
||||||
},
|
Some("auto") | _ => {
|
||||||
|
env::var_os("NO_COLOR").is_none() && self.interactive_output
|
||||||
|
}
|
||||||
|
},
|
||||||
paging_mode,
|
paging_mode,
|
||||||
term_width: maybe_term_width.unwrap_or(Term::stdout().size().1 as usize),
|
term_width: maybe_term_width.unwrap_or(Term::stdout().size().1 as usize),
|
||||||
loop_through: !(self.interactive_output
|
loop_through: !(self.interactive_output
|
||||||
@ -285,6 +288,7 @@ impl App {
|
|||||||
|
|
||||||
fn style_components(&self) -> Result<StyleComponents> {
|
fn style_components(&self) -> Result<StyleComponents> {
|
||||||
let matches = &self.matches;
|
let matches = &self.matches;
|
||||||
|
println!("{:#?}", matches);
|
||||||
Ok(StyleComponents(
|
Ok(StyleComponents(
|
||||||
if matches.value_of("decorations") == Some("never") {
|
if matches.value_of("decorations") == Some("never") {
|
||||||
HashSet::new()
|
HashSet::new()
|
||||||
|
@ -259,12 +259,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("always-decorations")
|
Arg::with_name("always-decorations")
|
||||||
.short("D")
|
.short("f")
|
||||||
.alias("always-decor")
|
.alias("always-decor")
|
||||||
.overrides_with("always-decorations")
|
.overrides_with("always-decorations")
|
||||||
.hidden(true)
|
.hidden(true)
|
||||||
.hidden_short_help(true)
|
.hidden_short_help(true)
|
||||||
.help("Alias for '--decorations=always'")
|
.help("Alias for '--decorations=always --color=always'")
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("paging")
|
Arg::with_name("paging")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user