Skip to content

Commit 0fdd895

Browse files
committed
Improve PATH warning with shell-specific permanent fix
Detects user shell, prints single copy-pasteable command that appends to rc file + reloads config.
1 parent 80540b7 commit 0fdd895

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

install.sh

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,22 @@ echo "Installed ${BINARY} and ghapp-gh to ${INSTALL_DIR}"
6767

6868
case ":$PATH:" in
6969
*":$INSTALL_DIR:"*) ;;
70-
*) echo ""
71-
echo "WARNING: $INSTALL_DIR is not in your PATH. Add it with:"
72-
echo " export PATH=\"$INSTALL_DIR:\$PATH\""
73-
echo "Then add that line to your ~/.bashrc or ~/.zshrc to make it permanent."
74-
;;
70+
*)
71+
# Detect user's shell rc file
72+
case "$(basename "$SHELL")" in
73+
zsh) RC_FILE="$HOME/.zshrc" ;;
74+
fish) RC_FILE="$HOME/.config/fish/config.fish" ;;
75+
*) RC_FILE="$HOME/.bashrc" ;;
76+
esac
77+
echo ""
78+
echo "WARNING: $INSTALL_DIR is not in your PATH. Run:"
79+
case "$(basename "$SHELL")" in
80+
fish)
81+
echo " echo 'fish_add_path $INSTALL_DIR' >> $RC_FILE && source $RC_FILE"
82+
;;
83+
*)
84+
echo " echo 'export PATH=\"\$HOME/.local/bin:\$PATH\"' >> $RC_FILE && source $RC_FILE"
85+
;;
86+
esac
87+
;;
7588
esac

0 commit comments

Comments
 (0)