Load completions at completion rather than load time

What happens when we install a new plugin or remove
an existing plugin? If we don't reload completions,
Fish won't be able to tab-complete for installed or
removed plugins, e.g., continue tab-completing when
they are no longer installed.

By loading `update` and `remove` completions at
completion load time we now invoke `fisher list`
every time the user tabs after `fisher update`
or `fisher remove`.
pull/627/head
Jorge Bucaran 4 years ago
parent dcbf55956e
commit 6e3b9d8023
No known key found for this signature in database
GPG Key ID: E54BA3C0E646DB30

@ -1,11 +1,7 @@
complete -c fisher -e
complete -c fisher -x -l help -d "print usage help"
complete -c fisher -x -l version -d "print fisher version"
complete -c fisher -x -n "__fish_use_subcommand" -a install -d "install plugins"
complete -c fisher -x -n "__fish_use_subcommand" -a update -d "update installed plugins"
complete -c fisher -x -n "__fish_use_subcommand" -a remove -d "remove installed plugins"
complete -c fisher -x -n "__fish_use_subcommand" -a list -d "list installed plugins matching <regex>"
for plugin in (fisher list)
complete -c fisher -x -n "__fish_seen_subcommand_from update remove" -a $plugin
end
complete -c fisher -x -n "__fish_seen_subcommand_from update remove" -a "(fisher list)"

@ -144,8 +144,6 @@ function fisher -a cmd -d "fish plugin manager"
functions -q fish_prompt || source $__fish_data_dir/functions/fish_prompt.fish
source $fisher_path/completions/fisher.fish 2>/dev/null
_fisher_list >$fish_plugins
test -s $fish_plugins || command rm -f $fish_plugins

Loading…
Cancel
Save