-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autocomplete & suggestions for nested subcommands not working in Picocli Shell JLine3? #969
Comments
It works with PicocliJLineCompleter but then I do not know how to make it work with builtins as well |
@niklas97 Thank you for raising this! I think I found the cause: Looking at the code for PicocliCommands it seems to only add completions for the top-level command and its immediate subcommands. Instead, it should recursively go down the full hierarchy. |
@remkop Great! |
@mattirn What do you think is the best approach for supporting nested sub-subcommands? Do you think it can be done with the existing |
I think we should wrote completer that support nested sub-subcommands i.e. somewhere in compileCompleters() |
We can probably resolve this by using the same approach as here JLine3 #518
|
…tion support for nested sub-subcommands
…tion support for nested sub-subcommands
Ideally @mattirn, I have taken a stab at modifying the The next step would be to recursively call |
…tion support for nested sub-subcommands; simplify code
…tion support for nested sub-subcommands; simplify code
…tion support for nested sub-subcommands; simplify further
I have added a code snippet to my previous comment in order to understand better my proposal. I'm afraid that your idea does not work with existing implementation. For a simple commands system completer should have completer like
for sub-commands
for subsub-commands
etc |
@mattirn Thanks for taking a look! Sub-commands (and nested sub-subcommands) themselves also have aliases and options, and I would like to do more than just completing the nested subcommand name. The first argument of the I thought support for nested subcommands could be accomplished by making this nested completer an I have refactored a bit further, but I am stuck here. The problem is that |
Actually, that last problem is relatively easy to solve by having a custom |
Sub-commands aliases I think can be easily supported. It is enough to add them in sub-command completer. But sub-command options is more challenging problem, I'm not really thought about this yet. The first argument of the In addition to the sub-command completer problem we have to fix also |
… working in Picocli Shell JLine3?
@niklas97 Please take a look at the latest picocli master: Thanks to @mattirn's PR the jline3 completion with picocli nested subcommands has improved a lot! (Nice work, @mattirn!) @niklas97 If you want to verify, do this:
That should publish |
For Picocli Shell JLine3, Is there any support for suggestions & autocomplete of nested subcommands? I tried to accomplish just that by adding a subcommand to one of the subcommands (the "cmd" named command in this case) of the example code at https://github.com/remkop/picocli/tree/master/picocli-shell-jline3 but it did not work. I.e., I can autocomplete the first subcommand but no subcommand of that subcommand.
Based on the description of PicocliCommands it should work.
Thanks in advance!
/ Niklas
The text was updated successfully, but these errors were encountered: