Long options improve readability of scripts, makes code comprehension easier.
This patch adds long options while preserving existing CLI interface.
Also --help/-h option is added
Details
- Reviewers
kevans cperciva pauamma_gundo.com emaste allanjude - Group Reviewers
manpages - Commits
- rG282e4cf32d4e: daemon: add long_opts
rG0a402ad2e6d6: daemon: add long_opts
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
usr.sbin/daemon/daemon.8 | ||
---|---|---|
82–83 | Should the defaults be given both here and in the individual flag descriptions? | |
89–91 | I'm not sure whether here and elsewhere in DESCRIPTION where options (other than the one being described, ie -o --output-file here) are mentioned, it's better to use the long form or the short form as diff(1) and others do. Opinions welcome. | |
158 | s/syslog tag/syslog-tag/ |
usr.sbin/daemon/daemon.8 | ||
---|---|---|
89–91 | IMHO long form improves readability everywhere, I don't have to look up what -H means every time. Short options are difficult to remember unless you work with this tool every day. But that being said I am happy to revert this if other reviewers feel the same. |
Meta: please generate phab diffs with full context included (-U999999, just really high); it makes reviewing a bit easier in the average case where additional context in the file might affect the review process (e.g., checking for consistency)
usr.sbin/daemon/daemon.8 | ||
---|---|---|
60 | Prevailing style is to insert a comma between the short option and long option in these listings, e.g., .It Fl c , Fl -change-dir | |
usr.sbin/daemon/daemon.c | ||
86 | Might as well const this | |
134 | I think we can drop this line, it's generally assumed that one will seek out the manpage for details. |
how about --help?
usr.sbin/daemon/daemon.c | ||
---|---|---|
133 | why not add a --help while you're at it? this way, drop the exit(1) from usage(), and exit as appropriate from main(). |
usr.sbin/daemon/daemon.c | ||
---|---|---|
133 | I was tempted to do this, but I was not sure if reviewers will like it. Not everybody likes the scope creep. I was planning to do this in a separate revision, but I will gladly add it to this diff! |
usr.sbin/daemon/daemon.c | ||
---|---|---|
110 | how we could pass on an option here if we're printing onto stderr or stdout, because often you'd want to foo --help | grep topic but i'd leave this to more experienced people |
usr.sbin/daemon/daemon.c | ||
---|---|---|
110 | I like the idea and this is easy to do, but I will keep this feature for the next diff, I want to keep this change scoped |
usr.sbin/daemon/daemon.c | ||
---|---|---|
222 | usage(0) would be better, and adjust usage to take a parameter and exit that value. Avoids errors like no {} from creeping in. |
usr.sbin/daemon/daemon.c | ||
---|---|---|
222 | and could double for the other requested change, 'if usage() is not an error, write to stdout instead of stderr' |
usr.sbin/daemon/daemon.c | ||
---|---|---|
222 | I'm not aware of another program does that in the tree, so I'd suggest that we don't do that here. |