Repository: sharkdp/bat (language: rust)

Issue:
extra themes help text to stderr
Can the help text for `--list-themes` from #1353 be written to stderr?
I'm using the command to retrieve themes for [completion](https://github.com/rsteube/carapace-bin/blob/master/completers/bat_completer/cmd/root.go#L86) and that interfers a bit.


Discussion / hints:
Thank you for reporting this. I should have paid more attention in the review.

> Can the help text for --list-themes from #1353 be written to stderr?

I think even better would be to disable this help text when we are not printing to an interactive terminal.
We already print a different version in that case (only a list of the names). We probably just have to move the `writeln!(…)` call up into the `if config.colored_output { … }` block

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2ef17a3857..8cabba21ad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@
 
 ## Bugfixes
 
+- only print themes hint in interactive mode (`bat --list-themes`), see #1439 (@rsteube)
+
 ## Other
 
 ## Syntaxes
diff --git a/src/bin/bat/main.rs b/src/bin/bat/main.rs
index eb6f75bc2a..cb50a84ff3 100644
--- a/src/bin/bat/main.rs
+++ b/src/bin/bat/main.rs
@@ -200,19 +200,19 @@ pub fn list_themes(cfg: &Config) -> Result<()> {
                 .ok();
             writeln!(stdout)?;
         }
+        writeln!(
+            stdout,
+            "Further themes can be installed to '{}', \
+            and are added to the cache with `bat cache --build`. \
+            For more information, see:\n\n  \
+            https://github.com/sharkdp/bat#adding-new-themes",
+            config_file().join("themes").to_string_lossy()
+        )?;
     } else {
         for theme in assets.themes() {
             writeln!(stdout, "{}", theme)?;
         }
     }
-    writeln!(
-        stdout,
-        "Further themes can be installed to '{}', \
-        and are added to the cache with `bat cache --build`. \
-        For more information, see:\n\n  \
-        https://github.com/sharkdp/bat#adding-new-themes",
-        config_file().join("themes").to_string_lossy()
-    )?;
 
     Ok(())
 }


Test patch: