File tree Expand file tree Collapse file tree 1 file changed +27
-9
lines changed
Expand file tree Collapse file tree 1 file changed +27
-9
lines changed Original file line number Diff line number Diff line change @@ -122,16 +122,34 @@ chmod +x "$INSTALL_DIR/copilot"
122122echo " ✓ GitHub Copilot CLI installed to $INSTALL_DIR /copilot"
123123rm -rf " $TMP_DIR "
124124
125- # Check if install directory is in PATH
126- case " :$PATH :" in
127- * " :$INSTALL_DIR :" * ) ;;
128- * )
125+ # Check if installed binary is accessible
126+ if ! command -v copilot > /dev/null 2>&1 ; then
127+ echo " "
128+ echo " Notice: $INSTALL_DIR is not in your PATH"
129+
130+ # Detect shell rc file
131+ case " $( basename " ${SHELL:-/ bin/ sh} " ) " in
132+ zsh) RC_FILE=" $HOME /.zshrc" ;;
133+ bash) RC_FILE=" $HOME /.bashrc" ;;
134+ * ) RC_FILE=" $HOME /.profile" ;;
135+ esac
136+
137+ # Prompt user to add to shell rc file (only if interactive)
138+ if [ -t 0 ] || [ -e /dev/tty ]; then
129139 echo " "
130- echo " Warning: $INSTALL_DIR is not in your PATH"
131- echo " Add it to your PATH by adding this line to your shell profile:"
132- echo " export PATH=\"\$ PATH:$INSTALL_DIR \" "
133- ;;
134- esac
140+ printf " Would you like to add it to %s? [y/N] " " $RC_FILE "
141+ if read -r REPLY < /dev/tty 2> /dev/null; then
142+ if [ " $REPLY " = " y" ] || [ " $REPLY " = " Y" ]; then
143+ echo " export PATH=\" $INSTALL_DIR :\$ PATH\" " >> " $RC_FILE "
144+ echo " ✓ Added PATH export to $RC_FILE "
145+ fi
146+ fi
147+ else
148+ echo " "
149+ echo " To add $INSTALL_DIR to your PATH permanently, add this to $RC_FILE :"
150+ echo " export PATH=\" $INSTALL_DIR :\$ PATH\" "
151+ fi
152+ fi
135153
136154echo " "
137155echo " Installation complete! Run 'copilot help' to get started."
You can’t perform that action at this time.
0 commit comments