From b767dd1eadd356597e57a24eb79abd9980f3a0ab Mon Sep 17 00:00:00 2001 From: Anson Hoyt Date: Fri, 16 Jan 2026 22:00:38 -0500 Subject: [PATCH] Fix --help/--version breaking shell integration Output help and version text to STDERR instead of STDOUT. The shell wrapper evals STDOUT on exit 0, so `try --version` was running `eval "try 1.7.1"` which launched the TUI with "1.7.1" as the search term. Similarly, `try --help` caused bash syntax errors. Alternatives considered: - Exit non-zero for help/version (implies error, misleading) - Output no-op shell command first (more complex) - Change wrapper to detect these flags (adds logic to shell function) STDERR is the common pattern for tools with shell integration (mise, direnv, etc.) and keeps the fix minimal. Co-Authored-By: Claude Opus 4.5 --- try.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/try.rb b/try.rb index f14355a..400bb20 100755 --- a/try.rb +++ b/try.rb @@ -826,7 +826,7 @@ def print_global_help Default path: ~/src/tries Current: #{TrySelector::TRY_PATH} HELP - STDOUT.print(text) + STDERR.print(text) end # Process color-related flags early @@ -844,7 +844,7 @@ def print_global_help # Version flag if ARGV.include?("--version") || ARGV.include?("-v") - puts "try #{VERSION}" + STDERR.puts "try #{VERSION}" exit 0 end