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

Syntax error in auto-completion script #2336

Open
rsenden opened this issue Sep 10, 2024 · 0 comments
Open

Syntax error in auto-completion script #2336

rsenden opened this issue Sep 10, 2024 · 0 comments

Comments

@rsenden
Copy link
Contributor

rsenden commented Sep 10, 2024

We have some picocli commands that can process instructions defined in an 'action' YAML file, with the YAML file defining acceptable CLI options (i.e., somewhat similar to picocli @Option). To have picocli accept and pass these options to our command, we use the following in our command implementation:

@Unmatched private String[] actionArgs;

As we want the synopsis to show a generic placeholder for these unmatched arguments, we add a dummy picocli option like the below:

@Option(names="--<action-parameter>", paramLabel="<value>") 
private List<String> dummyForSynopsis;

However, the special characters in the option name cause syntax errors in the command completion script generated by picocli:

-bash: ./fcli_completion: line 6357: syntax error near unexpected token `<'
-bash: ./fcli_completion: line 6357: `    --<action-parameter>)'

Of course, as an easy work-around, we could just rename this option to --action-parameter, but users may interpret this as a literal option name rather than generic placeholder. Also, ideally this dummy option shouldn't even be present in the completion script.

Can you think of any quick fixes/work-arounds to have something like --<action-parameter> listed in synopsis (and manual pages), but not included in the completion script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant