You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a command class similar to the following, with sub-commands being programmatically added to this command using commandLine.addSubcommand().
@Command(name = "retrieve", aliases = {"get"}, description = "Get data from various sources")
publicclassCompositeGetCommand {}
After sourcing the generated auto-completion script, something like mycmd retrieve <TAB><TAB> will correctly list the appropriate sub-commands. However, mycmd get <TAB><TAB> acts like the autocomplete script doesn't recognize the get alias, therefore listing the sub-commands of the mycmd parent command instead:
$ ./mycmd retrieve <TAB><TAB>
sub1 sub2 ...
$ ./mycmd get <TAB><TAB>
get retrieve ...
Looking at the auto-completion script, a duplicate cmd entry is generated for every alias, for example:
...
local cmds7=(retrieve)
local cmds8=(retrieve)
...
local cmds77=(retrieve sub1)
local cmds78=(retrieve sub2)
...
local cmds100=(retrieve sub1)
local cmds101=(retrieve sub2)
...
If I manually change this to the following, auto-completion starts working as expected:
...
local cmds7=(retrieve)
local cmds8=(get)
...
local cmds77=(retrieve sub1)
local cmds78=(retrieve sub2)
...
local cmds100=(get sub1)
local cmds101=(get sub2)
...
So, it seems like picocli is correctly recognizing aliases, but then incorrectly using the command name instead of alias when generating the autocomplete entries for these aliases.
Edit: The description above is for picocli 4.6.1. I just tried with picocli 4.6.2, where the behavior is slightly different with the following auto-complete script snippet being generated:
...
local cmds7=(retrieve)
local cmds8=(get)
...
local cmds77=(retrieve sub1)
local cmds78=(retrieve sub2)
...
local cmds100=(retrieve sub1)
local cmds101=(retrieve sub2)
...
With this, auto-completion works fine for both mycmd retrieve and mycmd get, but not for mycmd get sub1 as cmds100 and cmds101 are still not using the proper alias name.
The text was updated successfully, but these errors were encountered:
I have a command class similar to the following, with sub-commands being programmatically added to this command using
commandLine.addSubcommand()
.After sourcing the generated auto-completion script, something like
mycmd retrieve <TAB><TAB>
will correctly list the appropriate sub-commands. However,mycmd get <TAB><TAB>
acts like the autocomplete script doesn't recognize theget
alias, therefore listing the sub-commands of themycmd
parent command instead:Looking at the auto-completion script, a duplicate cmd entry is generated for every alias, for example:
If I manually change this to the following, auto-completion starts working as expected:
So, it seems like picocli is correctly recognizing aliases, but then incorrectly using the command name instead of alias when generating the autocomplete entries for these aliases.
Edit: The description above is for picocli 4.6.1. I just tried with picocli 4.6.2, where the behavior is slightly different with the following auto-complete script snippet being generated:
With this, auto-completion works fine for both
mycmd retrieve
andmycmd get
, but not formycmd get sub1
ascmds100
andcmds101
are still not using the proper alias name.The text was updated successfully, but these errors were encountered: