Is there a style guide to writing command line applications' arguments on unix platforms? Coming from the iOS world I'm thinking of something akin to the Human Interface Guidelines (HIG). I'm writing a script in Python that can take parameters.
Example: How to name arguments, when to use -dash
or --doubleDash
.
Look at this standard library module: http://docs.python.org/library/argparse.html
It will make your life much easier implementing a command line interface, and you end up using its style guide.
Note that argparse only became available in Python 2.7 (or 3.2, in the 3.x series). Before that there was http://docs.python.org/library/optparse.html, which results in a similar command line interface, but is not as much fun to use.
The GNU Coding Standards have a section on command line programs.
For a posixy feel, you shouldn't only provide the standard command line options, both short and long, but also, if possible, adhere to reading from the standard input (or the command line) and writing to the standard output, and only overriding the output with an option (like -o
/--output
). That's what one expects of most GNU command line tools.
Read The Art of Unix Usability http://www.catb.org/~esr/writings/taouu/taouu.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With