github twitter email rss
Command line interfaces (CLI)
0001 Jun 1
One minute read

Command line interfaces (CLI)

Few guidelines of UNIX conventional CLI

  • Meaningfull error messages, not stack trace
  • If no input given, show usage
  • Use separate output streams for real output and errors (stdout, stderr)

If first command produce error it will not be piped to second

myutil incorrectvalue | less

You still can redirect stderr to stdin

myutil incorrectvalue 2>&1 | less
  • Correctly use exit statuses
    Read man sysexits

If first part fails, second will not evaluate

myutil incorrectvalue && echo 'Welcome'
  • Provide Man Pages

Back to posts

comments powered by Disqus