mirror of
https://github.com/sharkdp/bat.git
synced 2026-10-30 10:06:12 +00:00
Fixed a bug with hardcoded terminal probing when --list-themes is called
This commit is contained in:
1 parent
93c52a4f88
commit
c3df0e6a88
2 files changed
+5
-6
No files matched your search
+1
-1
@@ -645,7 +645,7 @@ impl App {
|
|||||||
Ok(styled_components)
|
Ok(styled_components)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn theme_options(&self) -> ThemeOptions {
|
pub(crate) fn theme_options(&self) -> ThemeOptions {
|
||||||
Self::theme_options_from_matches(&self.matches)
|
Self::theme_options_from_matches(&self.matches)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-5
@@ -17,7 +17,6 @@ use std::path::Path;
|
|||||||
use std::process;
|
use std::process;
|
||||||
|
|
||||||
use bat::output::{OutputHandle, OutputType};
|
use bat::output::{OutputHandle, OutputType};
|
||||||
use bat::theme::DetectColorScheme;
|
|
||||||
use nu_ansi_term::Color::Green;
|
use nu_ansi_term::Color::Green;
|
||||||
use nu_ansi_term::Style;
|
use nu_ansi_term::Style;
|
||||||
|
|
||||||
@@ -39,7 +38,7 @@ use bat::{
|
|||||||
error::*,
|
error::*,
|
||||||
input::Input,
|
input::Input,
|
||||||
style::{StyleComponent, StyleComponents},
|
style::{StyleComponent, StyleComponents},
|
||||||
theme::{color_scheme, default_theme, ColorScheme},
|
theme::{default_theme, theme, ColorScheme, ThemeOptions},
|
||||||
MappingTarget, PagingMode,
|
MappingTarget, PagingMode,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -197,7 +196,7 @@ pub fn list_themes(
|
|||||||
cfg: &Config,
|
cfg: &Config,
|
||||||
config_dir: &Path,
|
config_dir: &Path,
|
||||||
cache_dir: &Path,
|
cache_dir: &Path,
|
||||||
detect_color_scheme: DetectColorScheme,
|
theme_options: ThemeOptions,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let assets = assets_from_cache_or_binary(cfg.use_custom_assets, cache_dir)?;
|
let assets = assets_from_cache_or_binary(cfg.use_custom_assets, cache_dir)?;
|
||||||
let mut config = cfg.clone();
|
let mut config = cfg.clone();
|
||||||
@@ -206,7 +205,7 @@ pub fn list_themes(
|
|||||||
config.language = Some("Rust");
|
config.language = Some("Rust");
|
||||||
config.style_components = StyleComponents(style);
|
config.style_components = StyleComponents(style);
|
||||||
|
|
||||||
let default_theme_name = default_theme(color_scheme(detect_color_scheme).unwrap_or_default());
|
let default_theme_name = theme(theme_options).to_string();
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
let mut handle = OutputHandle::FmtWrite(&mut buf);
|
let mut handle = OutputHandle::FmtWrite(&mut buf);
|
||||||
|
|
||||||
@@ -426,7 +425,7 @@ fn run() -> Result<bool> {
|
|||||||
};
|
};
|
||||||
run_controller(inputs, &plain_config, cache_dir)
|
run_controller(inputs, &plain_config, cache_dir)
|
||||||
} else if app.matches.get_flag("list-themes") {
|
} else if app.matches.get_flag("list-themes") {
|
||||||
list_themes(&config, config_dir, cache_dir, DetectColorScheme::default())?;
|
list_themes(&config, config_dir, cache_dir, app.theme_options())?;
|
||||||
Ok(true)
|
Ok(true)
|
||||||
} else if app.matches.get_flag("config-file") {
|
} else if app.matches.get_flag("config-file") {
|
||||||
println!("{}", config_file().to_string_lossy());
|
println!("{}", config_file().to_string_lossy());
|
||||||
|
|||||||
Reference in new issue
Block a user