|
|
@ -190,10 +190,11 @@ impl App {
|
|
|
|
.long("plain")
|
|
|
|
.long("plain")
|
|
|
|
.conflicts_with("style")
|
|
|
|
.conflicts_with("style")
|
|
|
|
.conflicts_with("number")
|
|
|
|
.conflicts_with("number")
|
|
|
|
.help("Show plain style (alias for '--style=plain').")
|
|
|
|
.conflicts_with("wrap")
|
|
|
|
|
|
|
|
.help("Show plain style (alias for '--style=plain' and '--wrap=never').")
|
|
|
|
.long_help(
|
|
|
|
.long_help(
|
|
|
|
"Only show plain style, no decorations. This is an alias for \
|
|
|
|
"Only show plain style, no decorations, no wrapping. This is an alias for \
|
|
|
|
'--style=plain'",
|
|
|
|
'--style=plain' and '--wrap=never'",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
).arg(
|
|
|
|
).arg(
|
|
|
|
Arg::with_name("number")
|
|
|
|
Arg::with_name("number")
|
|
|
@ -348,6 +349,9 @@ impl App {
|
|
|
|
// We don't have the tty width when piping to another program.
|
|
|
|
// We don't have the tty width when piping to another program.
|
|
|
|
// There's no point in wrapping when this is the case.
|
|
|
|
// There's no point in wrapping when this is the case.
|
|
|
|
OutputWrap::None
|
|
|
|
OutputWrap::None
|
|
|
|
|
|
|
|
} else if self.matches.is_present("plain") {
|
|
|
|
|
|
|
|
// No point in wrapping when it's plain.
|
|
|
|
|
|
|
|
OutputWrap::None
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
match self.matches.value_of("wrap") {
|
|
|
|
match self.matches.value_of("wrap") {
|
|
|
|
Some("character") => OutputWrap::Character,
|
|
|
|
Some("character") => OutputWrap::Character,
|
|
|
@ -379,8 +383,7 @@ impl App {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
term_width: self
|
|
|
|
term_width: self.matches
|
|
|
|
.matches
|
|
|
|
|
|
|
|
.value_of("terminal-width")
|
|
|
|
.value_of("terminal-width")
|
|
|
|
.and_then(|w| w.parse().ok())
|
|
|
|
.and_then(|w| w.parse().ok())
|
|
|
|
.unwrap_or(Term::stdout().size().1 as usize),
|
|
|
|
.unwrap_or(Term::stdout().size().1 as usize),
|
|
|
@ -388,8 +391,7 @@ impl App {
|
|
|
|
|| self.matches.value_of("color") == Some("always")
|
|
|
|
|| self.matches.value_of("color") == Some("always")
|
|
|
|
|| self.matches.value_of("decorations") == Some("always")),
|
|
|
|
|| self.matches.value_of("decorations") == Some("always")),
|
|
|
|
files,
|
|
|
|
files,
|
|
|
|
theme: self
|
|
|
|
theme: self.matches
|
|
|
|
.matches
|
|
|
|
|
|
|
|
.value_of("theme")
|
|
|
|
.value_of("theme")
|
|
|
|
.map(String::from)
|
|
|
|
.map(String::from)
|
|
|
|
.or_else(|| env::var("BAT_THEME").ok())
|
|
|
|
.or_else(|| env::var("BAT_THEME").ok())
|
|
|
@ -409,8 +411,10 @@ impl App {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
InputFile::Ordinary(filename)
|
|
|
|
InputFile::Ordinary(filename)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).collect()
|
|
|
|
})
|
|
|
|
}).unwrap_or_else(|| vec![InputFile::StdIn])
|
|
|
|
.collect()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.unwrap_or_else(|| vec![InputFile::StdIn])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn output_components(&self) -> Result<OutputComponents> {
|
|
|
|
fn output_components(&self) -> Result<OutputComponents> {
|
|
|
|