fix: fully respect --quiet flag and route tip messages to stderr

Two related issues:

1. The "cache not found" tip block after an error used `println!`, sending
   instructional text to stdout. This caused the output to appear inline
   in shell completion scripts (e.g. `tldr t<Tab>` in bash/fish). Changed
   to `eprintln!` so all diagnostic output goes to stderr.

2. The deprecation warning for old custom-pages naming convention was not
   gated by `--quiet`, so it printed even when the user requested silence.
   Added `!args.quiet` guard to match all other warning sites.

Fixes #268
This commit is contained in:
Yoshi Tacke 2026-04-19 23:24:46 +02:00
commit 3e50b6c08a

View file

@ -364,14 +364,14 @@ fn try_main(args: Cli, enable_styles: bool) -> Result<ExitCode> {
"Page cache not found. Please run `tldr --update` to download the cache."
),
);
println!("\nNote: You can optionally enable automatic cache updates by adding the");
println!("following config to your config file:\n");
println!(" [updates]");
println!(" auto_update = true\n");
println!("The path to your config file can be looked up with `tldr --show-paths`.");
println!("To create an initial config file, use `tldr --seed-config`.\n");
println!("You can find more tips and tricks in our docs:\n");
println!(" https://tealdeer-rs.github.io/tealdeer/config_updates.html");
eprintln!("\nNote: You can optionally enable automatic cache updates by adding the");
eprintln!("following config to your config file:\n");
eprintln!(" [updates]");
eprintln!(" auto_update = true\n");
eprintln!("The path to your config file can be looked up with `tldr --show-paths`.");
eprintln!("To create an initial config file, use `tldr --seed-config`.\n");
eprintln!("You can find more tips and tricks in our docs:\n");
eprintln!(" https://tealdeer-rs.github.io/tealdeer/config_updates.html");
return Ok(ExitCode::FAILURE);
};
@ -405,7 +405,7 @@ fn try_main(args: Cli, enable_styles: bool) -> Result<ExitCode> {
// Show command from cache
if !command.is_empty() {
// TODO: Remove this check 1 year after version 1.7.0 was released
if cache.old_custom_pages_exist()? {
if !args.quiet && cache.old_custom_pages_exist()? {
print_warning(
enable_styles,
&format!(