Skip to content
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

Don't generate Autocomplete for hide commands #1076

Closed
power721 opened this issue May 27, 2020 · 4 comments
Closed

Don't generate Autocomplete for hide commands #1076

power721 opened this issue May 27, 2020 · 4 comments
Labels
theme: auto-completion An issue or change related to auto-completion type: bug 🐛
Milestone

Comments

@power721
Copy link

I want to hide some commands.
It's hide from help message, but it does not hide from generated Autocomplete.

@remkop
Copy link
Owner

remkop commented May 27, 2020

Thank you for raising this!
That makes sense.

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

@remkop
Copy link
Owner

remkop commented May 28, 2020

@power721, what version of picocli are you using?
Looking at the code for AutoComplete, hidden commands should already be skipped... (This was fixed in #887 and released in picocli 4.1.2.)

Can you show me an example that reproduces this issue with the current version of picocli?

@power721
Copy link
Author

power721 commented Jun 3, 2020

I use 4.3.2.

        <dependency>
            <groupId>info.picocli</groupId>
            <artifactId>picocli</artifactId>
            <version>4.3.2</version>
        </dependency>

I hide the item get command:

    @Command(name = "get", hidden = true, description = "Get item from the Lockbox")
    public void get(@Parameters(description = "The key", paramLabel = "KEY") String key) {
        System.out.println(lockbox.get(key));
    }

Example output:

linux:~ # ./lockbox item
contains  create    get       remove    set       update
linux:~ # ./lockbox item
Missing required subcommand
Usage: lockbox item [COMMAND]
Manage lockbox items
Commands:
  contains  Check item exist in the Lockbox
  create    Create item in the Lockbox
  remove    Remove item from the Lockbox
  set       Set item in the Lockbox
  update    Update item in the Lockbox

@remkop remkop added this to the 4.4 milestone Jun 8, 2020
@remkop remkop added theme: auto-completion An issue or change related to auto-completion type: bug 🐛 labels Jun 8, 2020
@remkop
Copy link
Owner

remkop commented Jun 30, 2020

Fixed in master.
This will be included in the upcoming picocli 4.4 release.

Thank you again for raising this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: auto-completion An issue or change related to auto-completion type: bug 🐛
Projects
None yet
Development

No branches or pull requests

2 participants