Skip to content

Commit ee38110

Browse files
committed
docs: remove standalone eval references, use source pattern everywhere
Update all remaining docs, error messages, and hints to point to the source pattern or `git gtr help init` instead of bare eval. Doctor detection also matches source-pattern users (gtr/init- in rc).
1 parent 23dde98 commit ee38110

5 files changed

Lines changed: 11 additions & 21 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ cmd_editor() → resolve_target() → load_editor_adapter() → editor_open()
112112

113113
**`.gtrconfig`**: Team-shared config using gitconfig syntax, parsed via `git config -f`. Keys map differently from git config (e.g., `gtr.copy.include``copy.include`, `gtr.hook.postCreate``hooks.postCreate`). See the .gtrconfig Key Mapping table in README or `docs/configuration.md`.
114114

115-
**`init` command**: Outputs shell functions for `gtr cd <branch>` navigation. Output is cached to `~/.cache/gtr/` and auto-invalidates on version change. Users add `eval "$(git gtr init bash)"` to their shell rc file, or source the cache file directly for faster startup.
115+
**`init` command**: Outputs shell functions for `gtr cd <branch>` navigation. Output is cached to `~/.cache/gtr/` and auto-invalidates on version change. Users source the cache file directly in their shell rc for fast startup (see `git gtr help init`).
116116

117117
**`clean --merged`**: Removes worktrees whose PRs/MRs are merged. Auto-detects GitHub (`gh`) or GitLab (`glab`) from the `origin` remote URL. Override with `gtr.provider` config for self-hosted instances.
118118

bin/git-gtr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ main() {
110110
local _shell_name
111111
_shell_name="$(basename "${SHELL:-bash}")"
112112
log_error "'cd' requires shell integration (subprocesses cannot change your shell's directory)"
113-
log_info "Set up with: eval \"\$(git gtr init $_shell_name)\" (output is cached for fast startup)"
114-
log_info "Then use: gtr cd [<branch>]"
113+
log_info "Run 'git gtr help init' for setup instructions"
114+
log_info "Then use: gtr cd [<branch>]"
115115
exit 1
116116
;;
117117
*)

lib/commands/doctor.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,10 @@ cmd_doctor() {
128128
fish) _rc_file="$HOME/.config/fish/config.fish" ;;
129129
*) _rc_file="" ;;
130130
esac
131-
if [ -n "$_rc_file" ] && [ -f "$_rc_file" ] && grep -q 'git gtr init' "$_rc_file" 2>/dev/null; then
131+
if [ -n "$_rc_file" ] && [ -f "$_rc_file" ] && grep -qE 'git gtr init|gtr/init-' "$_rc_file" 2>/dev/null; then
132132
echo "[OK] Shell integration: loaded (gtr cd available)"
133133
elif [ -n "$_rc_file" ]; then
134-
local _init_hint
135-
if [ "$_shell_name" = "fish" ]; then
136-
_init_hint="git gtr init fish | source"
137-
else
138-
_init_hint="eval \"\$(git gtr init $_shell_name)\""
139-
fi
140-
echo "[i] Shell integration: $_init_hint in ${_rc_file##*/} for gtr cd"
134+
echo "[i] Shell integration: run 'git gtr help init' for setup instructions"
141135
fi
142136

143137
echo ""

lib/commands/help.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ Usage: git gtr go <branch>
102102
103103
Prints the absolute path to the specified worktree. Useful for navigation
104104
with cd or for scripting. For direct cd support, use shell integration:
105-
eval "$(git gtr init bash)" # then: gtr cd <branch>
106-
(output is cached automatically for fast startup)
105+
git gtr help init # see setup instructions
106+
gtr cd <branch> # then navigate directly
107107
108108
Special:
109109
Use '1' for the main repo root: git gtr go 1

lib/commands/init.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,8 @@ cmd_init() {
9090

9191
_init_bash() {
9292
cat <<'BASH'
93-
# git-gtr shell integration (output is cached to ~/.cache/gtr/)
94-
# Add to ~/.bashrc:
95-
# eval "$(git gtr init bash)"
96-
# Faster: source the cache file directly (see git gtr help init)
93+
# git-gtr shell integration (cached to ~/.cache/gtr/)
94+
# Setup: see git gtr help init
9795
9896
__FUNC__() {
9997
if [ "$#" -gt 0 ] && [ "$1" = "cd" ]; then
@@ -196,10 +194,8 @@ BASH
196194

197195
_init_zsh() {
198196
cat <<'ZSH'
199-
# git-gtr shell integration (output is cached to ~/.cache/gtr/)
200-
# Add to ~/.zshrc:
201-
# eval "$(git gtr init zsh)"
202-
# Faster: source the cache file directly (see git gtr help init)
197+
# git-gtr shell integration (cached to ~/.cache/gtr/)
198+
# Setup: see git gtr help init
203199
204200
__FUNC__() {
205201
emulate -L zsh

0 commit comments

Comments
 (0)