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

Suggestion: Ignore single-letter option values by default #1

Open
MrPetovan opened this issue Mar 19, 2018 · 4 comments
Open

Suggestion: Ignore single-letter option values by default #1

MrPetovan opened this issue Mar 19, 2018 · 4 comments

Comments

@MrPetovan
Copy link

Hi and thanks for this gem of a library that I started using over at https://github.com/friendica/friendica. While it does mostly a good job parsing the command-line separating arguments and options, the order is often critical to get the intended result.

For example with an example bin/console:

bin/console command -p
Arguments:

  • "command"

Options:

  • p: 1

But if the order is reversed the result is completely different:

bin/console -p command
Arguments: none

Options:

  • p: "command"

I'd like to suggest to ignore values for single-letter options and add the possibility to declare specific options that actually expect a value.

What do you think about it?

@asika32764
Copy link
Owner

asika32764 commented Mar 19, 2018

Hmm, In my experience it is an expected result if you add a string just after any option tag, it will look as the option's value.

I don't know what other console framework will do but this parsing method is fork from Joomla Clinput, so I just keep the same convention.

Is there any other CLI program ignore single letter option that I can reference to?

@asika32764
Copy link
Owner

OK, I can confirm composer will ignore single letter too.

If it is a convention of community, we should follow this way.

@asika32764
Copy link
Owner

But npm minimist uses same way as SimpleConsole.
https://www.npmjs.com/package/minimist

180319-0002

So I need more caes to research. Or simply add a property to toggle this function.

@MrPetovan
Copy link
Author

While working on my console, I was looking at what the git console command does. Single-letter options don't take values by default except for specific ones that are identified in the help.

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