Created attachment 1232
Two lines changed.
Just a tiny usability tweak that makes my life a little less annoying when I
have to check the dmd options.
(Disclaimer, I haven't tested the attached patch quite yet.)
Comment #1 by bearophile_hugs — 2013-07-11T08:28:32Z
What's the point of using --help with dmd?
If you want the help just call dmd with no switches:
dmd
Comment #2 by wyatt.epp — 2013-07-11T09:09:07Z
(In reply to comment #1)
> What's the point of using --help with dmd?
> If you want the help just call dmd with no switches:
>
> dmd
Honestly? I had no idea that was the case. I certainly don't expect that behaviour, and I question whether many others would either. I realise that POSIX doesn't specify -h or --help (I might consider this an oversight on their part), but one or both are present in most utilities by convention, unlike printing help in the absence of arguments (which doesn't appear to have any consistency whatsoever).
Comment #3 by bearophile_hugs — 2013-07-11T09:41:22Z
(In reply to comment #2)
> Honestly? I had no idea that was the case.
So now do you want to keep this ER open?
Comment #4 by wyatt.epp — 2013-07-11T10:30:47Z
(In reply to comment #3)
> (In reply to comment #2)
>
> > Honestly? I had no idea that was the case.
>
> So now do you want to keep this ER open?
I thought that was pretty clear. Regardless of what happens when you invoke dmd without arguments, this is still unexpected, and user expectation is foundational to usability. Educating one user doesn't propagate through them all. It's more useful to more users to follow sed and awk's example than to do what find does:
wyatt@Yue ~ $ find -h
find: unknown predicate `-h'
wyatt@Yue ~ $ dmd -h
Error: unrecognized switch '-h'
Another possibility would be to simply print the help when the switch is unrecognised, but I dislike this option because it removes the inherent "spell checking" for switches that the current behaviour provides. e.g.
wyatt@Yue ~ $ dmd -O -unitest -inline foo.d
Error: unrecognized switch '-unitest'
wyatt@Yue ~ $ dmd -O2 foo.d
Error: unrecognized switch '-O2'