Skip to content

Customizable usage message / operand specification

Created by: morozov

For a CLI application with fixed set of operands it'd be useful if it was possible to describe them explicitly in "usage" message. I.e. instead of

Usage: copy [options] [operands]
Options:
  --overwrite             Overwrite existing file

I'd like to have a more meaningful message like

Usage: copy [options] <from> <to> [<optional-operand>]
Options:
  --overwrite             Overwrite existing file

In fact, this example brings the idea of operands specification alongside with the one for options. Like options, operands may also have names, be mandatory or optional and have default values.