mirror of
https://github.com/sharkdp/bat.git
synced 2025-02-20 20:08:58 +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.
|
||||
WrappingMode::NoWrapping
|
||||
},
|
||||
colored_output: match self.matches.value_of("color") {
|
||||
Some("always") => true,
|
||||
Some("never") => false,
|
||||
Some("auto") | _ => env::var_os("NO_COLOR").is_none() && self.interactive_output,
|
||||
},
|
||||
colored_output: self.matches.is_present("always-decorations")
|
||||
|| match self.matches.value_of("color") {
|
||||
Some("always") => true,
|
||||
Some("never") => false,
|
||||
Some("auto") | _ => {
|
||||
env::var_os("NO_COLOR").is_none() && self.interactive_output
|
||||
}
|
||||
},
|
||||
paging_mode,
|
||||
term_width: maybe_term_width.unwrap_or(Term::stdout().size().1 as usize),
|
||||
loop_through: !(self.interactive_output
|
||||
@ -285,6 +288,7 @@ impl App {
|
||||
|
||||
fn style_components(&self) -> Result<StyleComponents> {
|
||||
let matches = &self.matches;
|
||||
println!("{:#?}", matches);
|
||||
Ok(StyleComponents(
|
||||
if matches.value_of("decorations") == Some("never") {
|
||||
HashSet::new()
|
||||
|
@ -259,12 +259,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("always-decorations")
|
||||
.short("D")
|
||||
.short("f")
|
||||
.alias("always-decor")
|
||||
.overrides_with("always-decorations")
|
||||
.hidden(true)
|
||||
.hidden_short_help(true)
|
||||
.help("Alias for '--decorations=always'")
|
||||
.help("Alias for '--decorations=always --color=always'")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("paging")
|
||||
|
Loading…
x
Reference in New Issue
Block a user