Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ if ! command -v copilot >/dev/null 2>&1; then
echo "Notice: $INSTALL_DIR is not in your PATH"

# Detect shell profile file for PATH
case "$(basename "${SHELL:-/bin/sh}")" in
CURRENT_SHELL="$(basename "${SHELL:-/bin/sh}")"
case "$CURRENT_SHELL" in
zsh) RC_FILE="${ZDOTDIR:-$HOME}/.zprofile" ;;
bash)
if [ -f "$HOME/.bash_profile" ]; then
Expand All @@ -163,29 +164,36 @@ if ! command -v copilot >/dev/null 2>&1; then
RC_FILE="$HOME/.profile"
fi
;;
fish) RC_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/fish/conf.d/copilot.fish" ;;
Copy link

Copilot AI Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the fish case, RC_FILE points into ${XDG_CONFIG_HOME:-$HOME/.config}/fish/conf.d/, which may not exist. Appending with >> "$RC_FILE" will fail with “No such file or directory”. Consider creating the parent directory (e.g., mkdir -p "$(dirname "$RC_FILE")") before writing or before printing instructions that reference this path.

Copilot uses AI. Check for mistakes.
*) RC_FILE="$HOME/.profile" ;;
esac

PATH_LINE="export PATH=\"$INSTALL_DIR:\$PATH\""
if [ "$CURRENT_SHELL" = "fish" ]; then
PATH_LINE="fish_add_path \"$INSTALL_DIR\""
fi

# Prompt user to add to shell rc file (only if interactive)
if [ -t 0 ] || [ -e /dev/tty ]; then
echo ""
printf "Would you like to add it to %s? [y/N] " "$RC_FILE"
if read -r REPLY </dev/tty 2>/dev/null; then
if [ "$REPLY" = "y" ] || [ "$REPLY" = "Y" ]; then
echo "export PATH=\"$INSTALL_DIR:\$PATH\"" >> "$RC_FILE"
echo "✓ Added PATH export to $RC_FILE"
mkdir -p "$(dirname "$RC_FILE")"
echo "$PATH_LINE" >> "$RC_FILE"
echo "✓ Added PATH configuration to $RC_FILE"
echo " Restart your shell or run: source $RC_FILE"
fi
fi
else
echo ""
echo "To add $INSTALL_DIR to your PATH permanently, add this to $RC_FILE:"
echo " export PATH=\"$INSTALL_DIR:\$PATH\""
echo " $PATH_LINE"
fi

echo ""
echo "Installation complete! To get started, run:"
echo " export PATH=\"$INSTALL_DIR:\$PATH\" && copilot help"
echo " $PATH_LINE && copilot help"
else
echo ""
echo "Installation complete! Run 'copilot help' to get started."
Expand Down
Loading