Command Line Application Style Guide

Is there a style guide for writing arguments for command line applications on unix platforms? Coming from the iOS world, I'm thinking of something like a Human Interface Guide (HIG) . I am writing a script in Python that can take parameters.

Example. How to specify arguments when to use -dash or --doubleDash .

+4
source share
3 answers

GNU coding standards contain a command line program section.

For perception of posixy, you should not only provide standard command-line options, both short and long, but also, if possible, stick to reading from standard input (or the command line) and writing to standard output, and only overriding the output with the option ( e.g. -o / --output ). This is what you can expect from most GNU command line tools.

+3
source

Take a look at this standard library module: http://docs.python.org/library/argparse.html

This will simplify your life by implementing the command line interface, and you end up using its style guide.

Note that argparse is only 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 leads to a similar command line interface, but not so much fun to use.

+5
source
+2
source

All Articles