diff options
author | Stéphane Blondon <stephane.blondon@gmail.com> | 2024-04-17 11:04:56 +0200 |
---|---|---|
committer | Martin Nordholts <enselic@gmail.com> | 2024-04-19 11:44:47 +0200 |
commit | bb4d1cbd2ef757e0b8cf59669c3145d2538e65e3 (patch) | |
tree | 535576bd264f2d2d2a9efacbf2c21fe7c170f1cc | |
parent | 23ec43316708b51f96ac3f9b5fc486494205236b (diff) |
-rw-r--r-- | src/bin/bat/main.rs | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/bin/bat/main.rs b/src/bin/bat/main.rs index 027f4ec4..4528a60b 100644 --- a/src/bin/bat/main.rs +++ b/src/bin/bat/main.rs @@ -201,13 +201,13 @@ pub fn list_themes(cfg: &Config, config_dir: &Path, cache_dir: &Path) -> Result< let mut stdout = stdout.lock(); let default_theme = HighlightingAssets::default_theme(); - if config.colored_output { - for theme in assets.themes() { - let default_theme_info = if default_theme == theme { - " (default)" - } else { - "" - }; + for theme in assets.themes() { + let default_theme_info = if default_theme == theme { + " (default)" + } else { + "" + }; + if config.colored_output { writeln!( stdout, "Theme: {}{}\n", @@ -219,7 +219,12 @@ pub fn list_themes(cfg: &Config, config_dir: &Path, cache_dir: &Path) -> Result< .run(vec![theme_preview_file()], None) .ok(); writeln!(stdout)?; + } else { + writeln!(stdout, "{theme}{default_theme_info}")?; } + } + + if config.colored_output { writeln!( stdout, "Further themes can be installed to '{}', \ @@ -228,15 +233,6 @@ pub fn list_themes(cfg: &Config, config_dir: &Path, cache_dir: &Path) -> Result< https://github.com/sharkdp/bat#adding-new-themes", config_dir.join("themes").to_string_lossy() )?; - } else { - for theme in assets.themes() { - let default_theme_info = if default_theme == theme { - " (default)" - } else { - "" - }; - writeln!(stdout, "{theme}{default_theme_info}")?; - } } Ok(()) |