mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-14 00:47:30 +00:00
3e3996c9a5
pipenv switched from older click-completion package to new built-in completions from click framework in v2021.11.9. This command achieves compatibility with both, older and more recent versions.
12 lines
575 B
Fish
12 lines
575 B
Fish
# try new completion generation of click first
|
|
set -l comps (_PIPENV_COMPLETE=fish_source pipenv 2>/dev/null)
|
|
if test -z "$comps" || string match -q 'Usage:*' -- $comps
|
|
# fall back to older click-completion used in prior versions
|
|
set comps (_PIPENV_COMPLETE=source-fish pipenv --completion 2>/dev/null)
|
|
end
|
|
|
|
set -q comps[1] && printf %s\n $comps | source
|
|
|
|
|
|
# manual workaround for pipenv run command completion until this is supported by the built-in mechanism
|
|
complete -c pipenv -n "__fish_seen_subcommand_from run" -a "(__fish_complete_subcommand --fcs-skip=2)" -x
|