install: add fish shell support for PATH configuration#2381
install: add fish shell support for PATH configuration#2381devm33 merged 1 commit intogithub:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class fish shell handling to the installer’s PATH configuration logic so fish users get a fish-compatible PATH command and the correct config file path.
Changes:
- Detects
fishas a distinct shell and targets~/.config/fish/conf.d/copilot.fish(or$XDG_CONFIG_HOMEequivalent). - Centralizes the shell-specific PATH command into a
PATH_LINEvariable used for interactive edits and printed hints. - Updates the installer’s non-interactive and “get started” messages to use
PATH_LINEinstead of hardcodedexport PATH=....
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| RC_FILE="$HOME/.profile" | ||
| fi | ||
| ;; | ||
| fish) RC_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/fish/conf.d/copilot.fish" ;; |
There was a problem hiding this comment.
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.
Fish shell users currently fall into the catch-all case, which writes POSIX export syntax to ~/.profile. Fish does not source ~/.profile and does not use export PATH="...:$PATH" syntax, so the PATH addition silently does nothing. Add a fish case that targets the idiomatic conf.d directory and uses fish_add_path, matching how the script already handles zsh and bash with their respective profile files and syntax. Extract the PATH command into a variable to avoid duplicating the shell-specific logic across the interactive prompt, non-interactive hint, and get-started instructions.
914f6ef to
07af0bc
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fish shell users currently fall into the catch-all
*)case in the shell profile detection, which writes POSIXexportsyntax to~/.profile. This silently does nothing because:~/.profileexport PATH="...:$PATH"syntax (PATH is an array in fish, not colon-separated)export PATH="..." && copilot helpfails in a fish sessionThis adds a
fish)case alongside the existingzsh)andbash)cases, using the idiomatic config path and command:${XDG_CONFIG_HOME:-$HOME/.config}/fish/conf.d/copilot.fish(auto-sourced by fish)fish_add_path(available since fish 3.2, released March 2021)The three places that previously hardcoded
export PATH=...now use aPATH_LINEvariable, so the shell-specific logic lives in one place rather than being duplicated across the interactive prompt, non-interactive hint, and get-started instructions.Before (fish user):
After (fish user):
No change in behavior for bash, zsh, or other POSIX shells.