Comment by pdkl95
6 years ago
A few additions to these recommendations:
> Show full help when -h and --help is passed
It is also a good idea to support --version
$ make --version
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
> Use standard names for flags, if there is a standard.
In the interest of consistency across tools, I recommend consulting the Table of Long Options from the GNU Coding Standards.
https://www.gnu.org/prep/standards/html_node/Option-Table.ht...
Some long options that are particularly helpful, when appropriate:
‘dry-run’
‘-n’ in make.
‘null’
‘-0’ in xargs.
Also, options that increase safety:
'no-clobber'
‘-n’ in mv
# do not overwrite an existing file
'overwrite'
‘-c’ in unshar
# even better than --no-clobber, require explicit
# permission before overwriting existing files
edit:
Never try to be "smart" or "magic" and guess what the user intended! DWIM can appear useful at first, but we've known for a long time that DWIM behavior is dangerous[1].
Depends on what you are doing. If it’s just a transformation or display of data, there’s no reason not to do what the user meant.