Skip to main content

Consistent

CLIs are the same across the whole product, follow our conventions and use our recommended frameworks.

Best practice

  • Always use a command line library when available
  • Always return a zero exit code to signal success
  • Always return non-zero exit code to signal failure
  • Always send your output to stdout
  • Always send your messaging to stderr

Best practice - Do

Best practice - Don't

Subcommands

  • Use consistent subcommands
  • Use consistent names for all subcommand levels
  • Use clear and unique names for subcommands

Subcommands - Do

Subcommands - Don't

Changes

  • Always try to make additive changes
  • Always warn users about non-additive changes
  • Avoid making breaking changes
  • Provide a migration period and strategy for breaking changes

Changes - Do

Changes - Don't