Picocli: Autocompletion for help command

Created on 14 May 2019  路  7Comments  路  Source: remkop/picocli

When registering HelpCommand.class as subcommand, no autogeneration for the help on other subcommands is generated.

Current behaviour: typing mycommand help <TAB><TAB> falls back to default autocompletion
Expected behaviour: registered commands are shown as candidates for autocompletion

Some ideas off the top of my head:

  • treat the HelpCommand as special case in the completion generation
  • modify the HelpCommand to register subcommands (works only for runtime help generation)
  • require some custom subclassing of the help command with specification of the possible completions (is this possible?)
auto-completion codegen enhancement shell

Most helpful comment

Glad I could help. I've add a dejagnu test picocompletion-help.exp and picocompletion-demo-help.exp in #1011 .

All 7 comments

I never realized, but you鈥檙e right.
To address this, I like the first option you mentioned best (Autocompletion logic to give special treatment to HelpCommand).

Will you be able to provide a pull request for this?

I cannot do this during work-time as this is something that is not important to my employee.
IF I find the time, I can look into it in my spare time. If I start working on this, I'll let you know here. But do not expect something soon. Sorry :(

Ok, cool! Contributions always welcome!

I added the special case for HelpCommand in autocompletion generation in PR #1009 .

It also includes a new test, not sure whether the new behaviour is as intended, but it should not break any previous tests.

@NewbieOrange I merged the PR into master.
Thank you for the contribution!

It would be great if you could also add an Expect test for the new completions to the dejagnu.tests.

This would be similar to the picocompletion.exp and picocompletion-demo.exp, but for the new src/test/resources/picocompletion-demo-help_completion.bash completion script you added.

Do you think you will be able to do that?

Glad I could help. I've add a dejagnu test picocompletion-help.exp and picocompletion-demo-help.exp in #1011 .

All merged.
Thank you again for the contributions! Nice work!

Was this page helpful?
0 / 5 - 0 ratings