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

Do not require angle brackets in argument #5

Merged
merged 1 commit into from Jun 21, 2014
Merged

Do not require angle brackets in argument #5

merged 1 commit into from Jun 21, 2014

Conversation

Minoru
Copy link
Contributor

@Minoru Minoru commented Jun 20, 2014

From ryanartecona's comment on issue #4:

Having to specify the angle brackets in an argument lookup does feel like a mistake, though.

Thought so, too! That turned out to be trivial to fix.

If you merge this, I can open an issue so you don't forget to make a new release once you get back from your vacation. Have a good time!

Docopt understands two kinds of arguments: <this> and THIS. Previously,
to match those one should have written `argument "<this>"` or `argument
"this"`, respectively; that is wrong.

Now one can write `argument "this"` to match both kinds of arguments.
@ryanartecona
Copy link
Member

Ah! Great catch. Thanks for the PR, and apologies for having to dig through the source of my first/only real Haskell project! :P

I think, technically, this fix results in arguments with the same name but differing style, e.g. ARG and <ARG>, clashing. Though since ARG and <arg> would coexist fine, I am good with this. Both cases are probably smells for a bad CLI anyway.

Will make a new release once I can test and verify. A new issue would be appreciated. :)

ryanartecona added a commit that referenced this pull request Jun 21, 2014
Do not require angle brackets in `argument`
@ryanartecona ryanartecona merged commit a3f3510 into docopt:master Jun 21, 2014
@Minoru
Copy link
Contributor Author

Minoru commented Jun 21, 2014

My pleasure! I don't know if the merit is Haskell's or yours, but the place I needed to tweak was really easy to find - just start with a function from public API and then grep a bit to find where pDocopt is defined.

I think, technically, this fix results in arguments with the same name but differing style, e.g. ARG and <ARG>, clashing.

I don't view that as a problem, because I don't think we need to distinguish between the two at all. To me, it's really a matter of style: you either choose one or another, and stick to it.

Both cases are probably smells for a bad CLI anyway.

I'm just curious: why do you think so?

@ryanartecona ryanartecona mentioned this pull request Feb 19, 2015
@ryanartecona
Copy link
Member

For the sake of tying off loose ends:

I'm just curious: why do you think so?

By "bad CLI", I really meant "an inconsistent usage page". A usage page which either uses both ARG and <ARG> or both ARG and <arg> style of positional arguments could just as easily choose one of those styles to use throughout that usage page.

I personally prefer the <brackets> because it reads less ambiguously to me, but I know some others are more accustomed to UPCASE. Either way, there's no reason to mix them in these same usage page, so we shouldn't worry about supporting that in docopt.

@Minoru
Copy link
Contributor Author

Minoru commented Feb 21, 2015

Oh, I just misunderstood the meaning of "both cases" back then — I read it as if you meant "both arg and <arg> smell of bad CLI". Consider that particular loose end a false one :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants