Skip to content

Commit 3298283

Browse files
committed
fix: Completions wofk with init fish
Instead of trying to use `fish_complete_path`, just source all the files. This also solves the problem of a file not being the same name as the file to be completed. This allows ammending completions for new git subcommands
1 parent 993ffec commit 3298283

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

docs/installation.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,13 @@ eval "$(bpm init bash)" # replace 'bash' with your shell
4747
For `fish`
4848

4949
```fish
50-
set -gx PATH "${XDG_DATA_HOME:-$HOME/.local/share}/bpm/source/pkg/bin" $PATH
51-
source (bpm init fish | psub)
50+
if test -n "$XDG_DATA_HOME"
51+
set -gx PATH $XDG_DATA_HOME/bpm/source/pkg/bin $PATH
52+
else
53+
set -gx PATH $HOME/.local/share/bpm/source/pkg/bin $PATH
54+
end
55+
56+
bpm init fish | source
5257
```
5358

5459
And now you're done! Move on to [Getting Started](./getting-started.md) to learn the basics

pkg/lib/commands/do-init.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ do-init() {
5757
set -gx BPM_PACKAGES_PATH $BPM_PACKAGES_PATH
5858
5959
# bpm completion
60-
set -g fish_complete_path \$BPM_ROOT/source/completions \$fish_complete_path
60+
source \$BPM_ROOT/source/completions/bpm.fish
6161
6262
# bpm include function
6363
if [ -f "$BPM_ROOT/source/pkg/share/include.fish" ]
@@ -70,7 +70,12 @@ do-init() {
7070
end
7171
7272
# bpm packages completions
73-
set -g fish_complete_path \$BPM_PREFIX/completions/fish \$fish_complete_path
73+
# set -gx fish_complete_path \$fish_complete_path
74+
if [ -d \$BPM_PREFIX/completions/fish ]
75+
for f in \$BPM_PREFIX/completions/fish/?*.fish
76+
source \$f
77+
end
78+
end
7479
EOF
7580
;;
7681
bash)

0 commit comments

Comments
 (0)