myapp /?
myapp -help
myapp -ver
etc....
GNU Coding Standards mandate --version
and --help
and I've come to expect any CLI program to support these. Other than that, it really depends on what the program is, but here are some other suggestions: -q
or --quiet
for less output, -v
or --verbose
for more output, -d
or --debug
for debugging output.
It depends on the platform.
On Windows, /? or /h or /help are common.
On Unix, a command should have a man page.
On Unix variants in which Gnu conventions are followed (e.g. Linux), it should respond to --help and --version. Even better, it can integrate with bash autocompletion.
Apart from that, look at other programs' in the same area as yours and use the same options where it makes sense. E.g.:
If your program accepts file names as arguments then common convention is for a single hyphen to mean 'read from stdin' and a double hyphen to mean 'treat the next argument as a file even if it begins with a hyphen'.
A short and long version of command line arguments. Check if there is a getopt
library port for the programming language that you use. It will help you in parsing command line arguments.
--config-file=FILE | -C FILE
--help | -h
--usage | -u
--version | -v
Include other relevant options for your application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With