JuliaLang / juliaup

Julia installer and version multiplexer
MIT License
975 stars 82 forks source link

Improving shell completions: completing command arguments and subcommands #790

Open fingolfin opened 8 months ago

fingolfin commented 8 months ago

Another thing one could improve about the tab completion: adding support for "subcommands" and arguments to commands. Right now, I always get the same completion for juliaup, even if there is already a command. E.g. if I have juliaup config in my prompt and press TAB twice, I get the same list as if I enter juliaup and press TAB twice, namely:

~$ juliaup config  # TAB TAB
-h                                    status
-V                                    gc
--help                                config
--version                             api
default                               46029ef5-0b73-4a71-bff3-d0d05de42aac
add                                   0cf1528f-0b15-46b1-9ac9-e5bf5ccccbcf
link                                  info
list                                  self
override                              completions
update                                4c79c12db1d34bbbab1f6c6f838f423f
remove                                help

I would expect to see the "subcommands", say:

backgroundselfupdateinterval
channelsymlinks
help
modifypath
startupselfupdateinterval
versionsdbupdateinterval

Again, that's what happens with e.g. git config or cargo build.

BoostCookie commented 1 month ago

It works for me, using zsh

% juliaup config  # TAB
channelsymlinks           -- Create a separate symlink per channel
help                      -- Print this message or the help of the given subcommand(s)
versionsdbupdateinterval  -- The time between automatic updates of the versions database in minutes, use 0 to disable