@@ -31,106 +31,111 @@ function __fish_asdf_arg_at -a number
3131end
3232
3333function __fish_asdf_list_versions -a plugin
34- asdf list $plugin 2> /dev/null | sed -e ' s/^[[:space:]]*// '
34+ asdf list $plugin 2> /dev/null | string trim | string trim --left --chars ' * '
3535end
3636
3737function __fish_asdf_list_all -a plugin
38- asdf list-all $plugin 2> /dev/null
38+ asdf list-all $plugin 2> /dev/null
3939end
4040
4141function __fish_asdf_plugin_list
42- asdf plugin-list 2> /dev/null
42+ asdf plugin-list 2> /dev/null
4343end
4444
4545function __fish_asdf_plugin_list_all
46- asdf plugin-list-all 2> /dev/null
46+ asdf plugin-list-all 2> /dev/null
4747end
4848
4949function __fish_asdf_list_shims
50- ls $asdf_data_dir /shims
50+ path basename $asdf_data_dir /shims/ *
5151end
5252
5353# update
54- complete -f -c asdf -n ' __fish_asdf_needs_command' -a update -d " Update asdf"
55- complete -f -c asdf -n ' __fish_asdf_using_command update; and __fish_asdf_arg_number 2' -l " head" -d " Updates to master HEAD"
54+ complete -f -c asdf -n __fish_asdf_needs_command -a update -d " Update asdf"
55+ complete -f -c asdf -n ' __fish_asdf_using_command update; and __fish_asdf_arg_number 2' -l head -d " Updates to master HEAD"
5656
5757# plugin-add completion
58- complete -f -c asdf -n ' __fish_asdf_needs_command' -a plugin-add -d " Add git repo as plugin"
58+ complete -f -c asdf -n __fish_asdf_needs_command -a plugin-add -d " Add git repo as plugin"
5959complete -f -c asdf -n ' __fish_asdf_using_command plugin-add; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_plugin_list_all | grep -v \' *\' | awk \' { print $1 }\' )'
6060complete -f -c asdf -n ' __fish_asdf_using_command plugin-add; and __fish_asdf_arg_number 3' -a ' (__fish_asdf_plugin_list_all | grep (__fish_asdf_arg_at 3) | awk \' { print $2 }\' )'
6161complete -f -c asdf -n ' __fish_asdf_using_command plugin-add; and __fish_asdf_arg_number 4'
6262
6363# plugin-list completion
64- complete -f -c asdf -n ' __fish_asdf_needs_command' -a plugin-list -d " List installed plugins"
64+ complete -f -c asdf -n __fish_asdf_needs_command -a plugin-list -d " List installed plugins"
6565
6666# plugin-list-all completion
67- complete -f -c asdf -n ' __fish_asdf_needs_command' -a plugin-list-all -d " List all existing plugins"
67+ complete -f -c asdf -n __fish_asdf_needs_command -a plugin-list-all -d " List all existing plugins"
6868
6969# plugin-remove completion
70- complete -f -c asdf -n ' __fish_asdf_needs_command' -a plugin-remove -d " Remove plugin and package versions"
70+ complete -f -c asdf -n __fish_asdf_needs_command -a plugin-remove -d " Remove plugin and package versions"
7171complete -f -c asdf -n ' __fish_asdf_using_command plugin-remove; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_plugin_list)'
7272
7373# plugin-update completion
74- complete -f -c asdf -n ' __fish_asdf_needs_command' -a plugin-update -d " Update plugin"
74+ complete -f -c asdf -n __fish_asdf_needs_command -a plugin-update -d " Update plugin"
7575complete -f -c asdf -n ' __fish_asdf_using_command plugin-update; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_plugin_list)'
7676complete -f -c asdf -n ' __fish_asdf_using_command plugin-update; and __fish_asdf_arg_number 2' -a --all
7777
7878# install completion
79- complete -f -c asdf -n ' __fish_asdf_needs_command' -a install -d " Install a specific version of a package"
79+ complete -f -c asdf -n __fish_asdf_needs_command -a install -d " Install a specific version of a package"
8080complete -f -c asdf -n ' __fish_asdf_using_command install; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_plugin_list)'
8181complete -f -c asdf -n ' __fish_asdf_using_command install; and __fish_asdf_arg_number 3' -a ' (__fish_asdf_list_all (__fish_asdf_arg_at 3))'
8282
8383# uninstall completion
84- complete -f -c asdf -n ' __fish_asdf_needs_command' -a uninstall -d " Remove a specific version of a package"
84+ complete -f -c asdf -n __fish_asdf_needs_command -a uninstall -d " Remove a specific version of a package"
8585complete -f -c asdf -n ' __fish_asdf_using_command uninstall; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_plugin_list)'
8686complete -f -c asdf -n ' __fish_asdf_using_command uninstall; and __fish_asdf_arg_number 3' -a ' (__fish_asdf_list_versions (__fish_asdf_arg_at 3))'
8787
8888# current completion
89- complete -f -c asdf -n ' __fish_asdf_needs_command' -a current -d " Display version set or being used for package"
89+ complete -f -c asdf -n __fish_asdf_needs_command -a current -d " Display version set or being used for package"
9090complete -f -c asdf -n ' __fish_asdf_using_command current; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_plugin_list)'
9191
9292# where completion
93- complete -f -c asdf -n ' __fish_asdf_needs_command' -a where -d " Display install path for an installed version"
93+ complete -f -c asdf -n __fish_asdf_needs_command -a where -d " Display install path for an installed version"
9494complete -f -c asdf -n ' __fish_asdf_using_command where; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_plugin_list)'
9595complete -f -c asdf -n ' __fish_asdf_using_command where; and __fish_asdf_arg_number 3' -a ' (__fish_asdf_list_versions (__fish_asdf_arg_at 3))'
9696
9797# which completion
98- complete -f -c asdf -n ' __fish_asdf_needs_command' -a which -d " Display executable path for a command"
98+ complete -f -c asdf -n __fish_asdf_needs_command -a which -d " Display executable path for a command"
9999complete -f -c asdf -n ' __fish_asdf_using_command which; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_list_shims)'
100100
101101# latest completion
102- complete -f -c asdf -n ' __fish_asdf_needs_command' -a latest -d " Show latest stable version of a package"
102+ complete -f -c asdf -n __fish_asdf_needs_command -a latest -d " Show latest stable version of a package"
103103complete -f -c asdf -n ' __fish_asdf_using_command latest; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_plugin_list)'
104+ complete -f -c asdf -n ' __fish_asdf_using_command latest; and __fish_asdf_arg_number 2' -a --all
104105
105106# list completion
106- complete -f -c asdf -n ' __fish_asdf_needs_command' -a list -d " List installed versions of a package"
107+ complete -f -c asdf -n __fish_asdf_needs_command -a list -d " List installed versions of a package"
107108complete -f -c asdf -n ' __fish_asdf_using_command list; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_plugin_list)'
108109
109110# list-all completion
110- complete -f -c asdf -n ' __fish_asdf_needs_command' -a list-all -d " List all versions of a package"
111+ complete -f -c asdf -n __fish_asdf_needs_command -a list-all -d " List all versions of a package"
111112complete -f -c asdf -n ' __fish_asdf_using_command list-all; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_plugin_list)'
112113
113114# reshim completion
114- complete -f -c asdf -n ' __fish_asdf_needs_command' -a reshim -d " Recreate shims for version of a package"
115+ complete -f -c asdf -n __fish_asdf_needs_command -a reshim -d " Recreate shims for version of a package"
115116complete -f -c asdf -n ' __fish_asdf_using_command reshim; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_plugin_list)'
116117complete -f -c asdf -n ' __fish_asdf_using_command reshim; and __fish_asdf_arg_number 3' -a ' (__fish_asdf_list_versions (__fish_asdf_arg_at 3))'
117118
119+ # shim-versions completion
120+ complete -f -c asdf -n __fish_asdf_needs_command -a shim-versions -d " List the plugins and versions that provide a command"
121+ complete -f -c asdf -n ' __fish_asdf_using_command shim-versions; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_list_shims)'
122+
118123# local completion
119- complete -f -c asdf -n ' __fish_asdf_needs_command' -a local -d " Set local version for a plugin"
124+ complete -f -c asdf -n __fish_asdf_needs_command -a local -d " Set local version for a plugin"
120125complete -f -c asdf -n ' __fish_asdf_using_command local; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_plugin_list)'
121126complete -f -c asdf -n ' __fish_asdf_using_command local; and test (count (commandline -opc)) -gt 2' -a ' (__fish_asdf_list_versions (__fish_asdf_arg_at 3)) system'
122127
123128# global completion
124- complete -f -c asdf -n ' __fish_asdf_needs_command' -a global -d " Set global version for a plugin"
129+ complete -f -c asdf -n __fish_asdf_needs_command -a global -d " Set global version for a plugin"
125130complete -f -c asdf -n ' __fish_asdf_using_command global; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_plugin_list)'
126131complete -f -c asdf -n ' __fish_asdf_using_command global; and test (count (commandline -opc)) -gt 2' -a ' (__fish_asdf_list_versions (__fish_asdf_arg_at 3)) system'
127132
128133# shell completion
129- complete -f -c asdf -n ' __fish_asdf_needs_command' -a shell -d " Set version for a plugin in current shell session"
134+ complete -f -c asdf -n __fish_asdf_needs_command -a shell -d " Set version for a plugin in current shell session"
130135complete -f -c asdf -n ' __fish_asdf_using_command shell; and __fish_asdf_arg_number 2' -a ' (__fish_asdf_plugin_list)'
131136complete -f -c asdf -n ' __fish_asdf_using_command shell; and test (count (commandline -opc)) -gt 2' -a ' (__fish_asdf_list_versions (__fish_asdf_arg_at 3)) system'
132137
133138# misc
134- complete -f -c asdf -n ' __fish_asdf_needs_command' -l " help" -d " Displays help"
135- complete -f -c asdf -n ' __fish_asdf_needs_command' -a " info" -d " Print OS, Shell and ASDF debug information"
136- complete -f -c asdf -n ' __fish_asdf_needs_command' -l " version" -d " Displays asdf version"
139+ complete -f -c asdf -n __fish_asdf_needs_command -l help -d " Displays help"
140+ complete -f -c asdf -n __fish_asdf_needs_command -a info -d " Print OS, Shell and ASDF debug information"
141+ complete -f -c asdf -n __fish_asdf_needs_command -l version -d " Displays asdf version"
0 commit comments