From b0eb89e9cd45ca66db0cb7935adfb55268879cff Mon Sep 17 00:00:00 2001 From: Alex Pilon Date: Wed, 18 Feb 2026 10:10:46 -0500 Subject: [PATCH] Export TRY_PATH env var from init output Allow other tools to discover the tries directory by reading $TRY_PATH from the environment. The init command now emits an export (bash/zsh) or set -gx (fish) before the function definition. Co-authored-by: Cursor --- try.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/try.rb b/try.rb index 94cf0a7..8b6be47 100755 --- a/try.rb +++ b/try.rb @@ -1168,7 +1168,9 @@ def cmd_init!(args, tries_path) end path_arg = tries_path ? " --path '#{tries_path}'" : "" + export_line = tries_path ? "export TRY_PATH='#{tries_path}'" : "" bash_or_zsh_script = <<~SHELL + #{export_line} try() { local out out=$(/usr/bin/env ruby '#{script_path}' exec#{path_arg} "$@" 2>/dev/tty) @@ -1180,7 +1182,9 @@ def cmd_init!(args, tries_path) } SHELL + fish_export = tries_path ? "set -gx TRY_PATH '#{tries_path}'" : "" fish_script = <<~SHELL + #{fish_export} function try set -l out (/usr/bin/env ruby '#{script_path}' exec#{path_arg} $argv 2>/dev/tty | string collect) if test $pipestatus[1] -eq 0