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

Specify short form of CLAP flag, when having multiple flags starting with same letter #34

Open
Bajger opened this issue Jan 11, 2022 · 2 comments

Comments

@Bajger
Copy link
Contributor

Bajger commented Jan 11, 2022

Enhance ClapFlag with option to specify short form of flag name.

Describe the request
Currently, short form ClapFlag instance is always represented by first letter of long version name. This causes a problem, when having multiple flags starting with same letter, e.g. noHeader and name. There should be an option to specify short name programmatically (when specifying command) in order to avoid name conficts.

Expected behavior

(ClapFlag id: #name)
	description: 'Name description.';
        shortName: 'n';

...
(ClapFlag id: #noHeader)
	description: 'No header description.';
        shortName: 'h';

Expected development cost

  • Add instance variable on ClapFlag class and setter method.
  • Modify shortName getter method to access instance variable and assign first letter substring in initialize method (or lazy assignment).

Version information:

  • reported on CLAP version: 1163bde
@cdlm
Copy link
Collaborator

cdlm commented Jan 11, 2022

👍🏻 I would advise keeping the dash out of the shortName: though.
At some point I was thinking of aliases instead of just short/long names, because many commands have synonymous flags, or variants with slight semantic differences like --foo / --no-foo

@Bajger
Copy link
Contributor Author

Bajger commented Jan 11, 2022

I would advise keeping the dash out of the shortName: though.

Got it! Dash removed from example.

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

2 participants