Re: how optparse can go horribly wrong
- From
Clemens Buchacher <drizzd@aon.at>
- Date
- Sep 28, 2009, 13:37 UTC
- Message-ID
- <20090928133707.GA3343@localhost>
- In-Reply-To
- <20090926192527.GF14660@spearce.org>
On Sat, Sep 26, 2009 at 12:25:27PM -0700, Shawn O. Pearce wrote:
> What I think we should do is not allow cuddling of short options > when the final option takes more than 1 character worth of argument. > Thus `git commit -a -mfoo` is OK, but `git commit -amfoo` is not.
I also think that would be the most sensible solution.
A little experimentation with git-log reveals that it does not behave very well either.
git log -n1asdf -> asdf is ignored git log -pn1 -> error git log -p1 -> error git log -1p -> p is ignored
So I think this should instead behave just like you described above.
git log -n1asdf -> error: unknown option(s) -asdf git log -pn1 -> git log -p -n1 git log -p1 -> git log -p -n1 git log -1p -> git log -p -n1
Clemens