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

Bad Autocomplete Output When Tab Completing a File With a Space #1458

Closed
zpater345 opened this issue Nov 10, 2021 · 2 comments · Fixed by #1473
Closed

Bad Autocomplete Output When Tab Completing a File With a Space #1458

zpater345 opened this issue Nov 10, 2021 · 2 comments · Fixed by #1473
Labels
theme: auto-completion An issue or change related to auto-completion type: bug 🐛
Milestone

Comments

@zpater345
Copy link

I am currently experiencing an issue with tab completion on an installed application running PicoCLI 4.6.1 and java 11 on Fedora 34.

Here is a snippet of the command line class for this project:

...
import picocli.CommandLine.*;
import picocli.CommandLine.Model.*;
...

@Command(name = "bcc")
public class BccCommands implements Runnable{

    @Spec
    CommandSpec spec;

    @Option(names = {"-s", "--snapshot"}, description = "Loads the specified snapshot file immediately upon launch.  Use full paths.")
    public File snapshotFile;

   ...
}

...
	_cmd = new BccCommands();
       	_cmdParser = new picocli.CommandLine(_cmd);
        _cmdParser.setCaseInsensitiveEnumValuesAllowed(true);
        _cmdParser.setOverwrittenOptionsAllowed(true);
...

I am currently generating the AutoComplete using Maven and picocli.AutoComplete to generate a bcc11_completion script.

With the generated completion script in /etc/bash_completions.d/ I can do the following:

bcc11 --snap<TAB><TAB>

and get

bcc11 --snapshot 

as expected

However when I try to add the file path and use tab completion to fill in the file path like this:

bcc11 --snapshot /home/zpater/Snapshots/2<TAB><TAB>

I get the following output:
image

but I would expect something similar to this:
image

If I tab complete on a combination that doesn't find a file with a space in it, I get the expected result:
image

There seems to be an issue with the completion script I generated and spaces. Is there anything I can do to resolve this issue?

@remkop remkop added theme: auto-completion An issue or change related to auto-completion type: bug 🐛 labels Nov 10, 2021
@remkop
Copy link
Owner

remkop commented Nov 10, 2021

Hi @zpater345, thank you for raising this!
Picocli 4.6.2 has just been released, can I ask you to check if the problem still exists in the latest version?

@zpater345
Copy link
Author

I updated this morning and the behavior didn't change

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

Successfully merging a pull request may close this issue.

2 participants