mirror of
https://github.com/sharkdp/bat.git
synced 2025-03-21 18:18:31 +00:00
updated PR based on comments
This commit is contained in:
parent
ccdea6a429
commit
d349974089
@ -165,7 +165,7 @@ 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: self.matches.is_present("always-decorations")
|
colored_output: self.matches.is_present("force-colorization")
|
||||||
|| match self.matches.value_of("color") {
|
|| match self.matches.value_of("color") {
|
||||||
Some("always") => true,
|
Some("always") => true,
|
||||||
Some("never") => false,
|
Some("never") => false,
|
||||||
@ -178,7 +178,7 @@ impl App {
|
|||||||
loop_through: !(self.interactive_output
|
loop_through: !(self.interactive_output
|
||||||
|| 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")
|
||||||
|| self.matches.is_present("always-decorations"))),
|
|| self.matches.is_present("force-colorization"))),
|
||||||
tab_width: self
|
tab_width: self
|
||||||
.matches
|
.matches
|
||||||
.value_of("tabs")
|
.value_of("tabs")
|
||||||
@ -288,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()
|
||||||
|
@ -258,13 +258,16 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("always-decorations")
|
Arg::with_name("force-colorization")
|
||||||
|
.long("force-colorization")
|
||||||
.short("f")
|
.short("f")
|
||||||
.alias("always-decor")
|
.conflicts_with("color")
|
||||||
.overrides_with("always-decorations")
|
.conflicts_with("decorations")
|
||||||
.hidden(true)
|
.overrides_with("force-colorization")
|
||||||
.hidden_short_help(true)
|
.hidden_short_help(true)
|
||||||
.help("Alias for '--decorations=always --color=always'")
|
.long_help("Alias for '--decorations=always --color=always'. This is useful \
|
||||||
|
if the output of bat is piped to another program, but you want \
|
||||||
|
to keep the colorization/decorations.")
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("paging")
|
Arg::with_name("paging")
|
||||||
|
@ -209,6 +209,7 @@ fn run() -> Result<bool> {
|
|||||||
} else {
|
} else {
|
||||||
let inputs = vec![Input::ordinary_file(OsStr::new("cache"))];
|
let inputs = vec![Input::ordinary_file(OsStr::new("cache"))];
|
||||||
let config = app.config(&inputs)?;
|
let config = app.config(&inputs)?;
|
||||||
|
println!("{:#?}", config);
|
||||||
|
|
||||||
run_controller(inputs, &config)
|
run_controller(inputs, &config)
|
||||||
}
|
}
|
||||||
@ -217,6 +218,8 @@ fn run() -> Result<bool> {
|
|||||||
let inputs = app.inputs()?;
|
let inputs = app.inputs()?;
|
||||||
let config = app.config(&inputs)?;
|
let config = app.config(&inputs)?;
|
||||||
|
|
||||||
|
println!("{:#?}", config);
|
||||||
|
|
||||||
if app.matches.is_present("list-languages") {
|
if app.matches.is_present("list-languages") {
|
||||||
list_languages(&config)?;
|
list_languages(&config)?;
|
||||||
Ok(true)
|
Ok(true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user