@@ -148,7 +148,8 @@ if ! command -v copilot >/dev/null 2>&1; then
148148 echo " Notice: $INSTALL_DIR is not in your PATH"
149149
150150 # Detect shell profile file for PATH
151- case " $( basename " ${SHELL:-/ bin/ sh} " ) " in
151+ CURRENT_SHELL=" $( basename " ${SHELL:-/ bin/ sh} " ) "
152+ case " $CURRENT_SHELL " in
152153 zsh) RC_FILE=" ${ZDOTDIR:- $HOME } /.zprofile" ;;
153154 bash)
154155 if [ -f " $HOME /.bash_profile" ]; then
@@ -159,29 +160,36 @@ if ! command -v copilot >/dev/null 2>&1; then
159160 RC_FILE=" $HOME /.profile"
160161 fi
161162 ;;
163+ fish) RC_FILE=" ${XDG_CONFIG_HOME:- $HOME / .config} /fish/conf.d/copilot.fish" ;;
162164 * ) RC_FILE=" $HOME /.profile" ;;
163165 esac
164166
167+ PATH_LINE=" export PATH=\" $INSTALL_DIR :\$ PATH\" "
168+ if [ " $CURRENT_SHELL " = " fish" ]; then
169+ PATH_LINE=" fish_add_path \" $INSTALL_DIR \" "
170+ fi
171+
165172 # Prompt user to add to shell rc file (only if interactive)
166173 if [ -t 0 ] || [ -e /dev/tty ]; then
167174 echo " "
168175 printf " Would you like to add it to %s? [y/N] " " $RC_FILE "
169176 if read -r REPLY < /dev/tty 2> /dev/null; then
170177 if [ " $REPLY " = " y" ] || [ " $REPLY " = " Y" ]; then
171- echo " export PATH=\" $INSTALL_DIR :\$ PATH\" " >> " $RC_FILE "
172- echo " ✓ Added PATH export to $RC_FILE "
178+ mkdir -p " $( dirname " $RC_FILE " ) "
179+ echo " $PATH_LINE " >> " $RC_FILE "
180+ echo " ✓ Added PATH configuration to $RC_FILE "
173181 echo " Restart your shell or run: source $RC_FILE "
174182 fi
175183 fi
176184 else
177185 echo " "
178186 echo " To add $INSTALL_DIR to your PATH permanently, add this to $RC_FILE :"
179- echo " export PATH= \" $INSTALL_DIR : \$ PATH \" "
187+ echo " $PATH_LINE "
180188 fi
181189
182190 echo " "
183191 echo " Installation complete! To get started, run:"
184- echo " export PATH= \" $INSTALL_DIR : \$ PATH \" && copilot help"
192+ echo " $PATH_LINE && copilot help"
185193else
186194 echo " "
187195 echo " Installation complete! Run 'copilot help' to get started."
0 commit comments