D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 10611 - Add -h as shorthand for --help
Summary: Add -h as shorthand for --help
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-11 08:22 UTC by Wyatt
Modified: 2022-04-29 14:53 UTC (History)
2 users (show)

See Also:


Attachments
Two lines changed. (879 bytes, application/octet-stream)
2013-07-11 08:22 UTC, Wyatt
Details

Note You need to log in before you can comment on or make changes to this issue.
Description Wyatt 2013-07-11 08:22:27 UTC
Created attachment 1232 [details]
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 bearophile_hugs 2013-07-11 08:28:32 UTC
What's the point of using --help with dmd?
If you want the help just call dmd with no switches:

dmd
Comment 2 Wyatt 2013-07-11 09:09:07 UTC
(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 bearophile_hugs 2013-07-11 09:41:22 UTC
(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 Wyatt 2013-07-11 10:30:47 UTC
(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'
Comment 5 Dennis 2022-04-29 14:53:33 UTC
The -h flag has been added some time ago