Skip to content

Commit 050b26a

Browse files
authored
fix: show helpful error when running git gtr cd (#137)
1 parent daee0c1 commit 050b26a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

bin/git-gtr

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ main() {
106106
help|--help|-h)
107107
cmd_help "$@"
108108
;;
109+
cd)
110+
local _shell_name
111+
_shell_name="$(basename "${SHELL:-bash}")"
112+
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)\""
114+
log_info "Then use: gtr cd [<branch>]"
115+
exit 1
116+
;;
109117
*)
110118
log_error "Unknown command: $cmd"
111119
echo "Use 'git gtr help' for available commands"

0 commit comments

Comments
 (0)