Standards for Command Line Interfaces

· Read in about 1 min · (163 Words)

Some common practice  summerized from other great tools.

last update: 2014-09-08


The name should be descriptive and easy to remember.


Use option parser library  to parse them. Long-named option is recommended to make them readable.

Some necessary options

  • –help  Print introduction, usage and examples.
  • –version  Version is needed!
  • –verbose  Print additional information.

Additional options

  • -t Number of threads (concurrency).


  • Input. Better to support reading from standard input (stdin). If not, first argument could be the input file.
  • Output. Result could be printed to standard output (stdout) or saved to file specified by option -o . For better use in pipe, information, warning and error should be printed to stdout.
  • Both input and output should support dealing with archive file, e.g.,  gzip.


  • Use sub-command for different functions.
  • Multiple threads or concurrency (golang etc.) should be supported.

See more

To be continued …