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

Issue with map fields when clustered short options are disallowed #488

Closed
MaryamZi opened this issue Sep 19, 2018 · 6 comments
Closed

Issue with map fields when clustered short options are disallowed #488

MaryamZi opened this issue Sep 19, 2018 · 6 comments
Labels
theme: parser An issue or change related to the parser type: doc 📘 type: question ❔
Milestone

Comments

@MaryamZi
Copy link

Description

When clustered short options are disallowed with
CommandLine.setPosixClusteredShortOptionsAllowed(false)

specifying arguments for map fields as follows
-Pmyprop=myvalue

fails with the exception
picocli.CommandLine$UnmatchedArgumentException: Unknown option: -Pmyprop=myvalue

The space is now required between -P and the key-value pair.
-P myprop=myvalue //works

Is this the expected behaviour? IMO, map fields are different from other fields, and it would be useful to have the support for the former even when clustered short options are not allowed.

Version
3.3.0

@remkop
Copy link
Owner

remkop commented Sep 19, 2018

Hi, yes, this is the expected behaviour (also in the current latest version 3.6.0).

POSIX allows an option parameter value attached to the last option in a cluster (tar -xvfSomeFile.tar), while GNU for example needs the option name either separated by a space or attached to the option parameter with a = separator char (--file SomeFile or --file=SomeFile).

This seemed natural to me but we can change this or add a new parser configuration switch.

@remkop
Copy link
Owner

remkop commented Sep 20, 2018

@MaryamZi Are you okay with the current behaviour or do you need this to behave differently?

@remkop
Copy link
Owner

remkop commented Sep 20, 2018

As a side-note, it may be good to have this question on StackOverflow to build a knowledge base for other picocli users. Would you be okay with moving this conversation to StackOverflow?

@remkop
Copy link
Owner

remkop commented Sep 21, 2018

I went ahead and posted this question on StackOverflow.

@MaryamZi
Copy link
Author

@remkop sorry about the delay in responding. The current behaviour is OK, just wanted to clarify if this was the expected behaviour.

Should we maybe include this in the documentation too, since all possible ways of specification are mentioned in the example?

Thank you!

@remkop
Copy link
Owner

remkop commented Sep 21, 2018

@MaryamZi No worries, glad to hear the current behaviour is ok.

Good idea to clarify the docs. I will add a note to the https://picocli.info/#_posix_clustered_short_options section.

@remkop remkop added this to the 3.6.1 milestone Sep 25, 2018
@remkop remkop closed this as completed in 8d425cd Sep 26, 2018
@remkop remkop added the theme: parser An issue or change related to the parser label Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: parser An issue or change related to the parser type: doc 📘 type: question ❔
Projects
None yet
Development

No branches or pull requests

2 participants