A help option is a command-line option that requests usage information and program documentation. Python’s argparse module commonly provides -h and --help automatically. section 1.7 section 2.1.4
Inspecting a program’s interface
Running ./hello.py -h prints the usage pattern, description, positional arguments, and the help option itself. Running without the required name instead prints usage and an error. section 1.7 section 2.1.4
A help option can:
- Document positional arguments and optional parameters. section 2.1.4
- Show defaults, accepted inputs, and a program description. section 19.1
- Provide immediate guidance before normal program execution. section 1.7
$ ./hello.py -h usage: hello.py [-h] name Say hello : name Name to greet #1 : -h, --help show this help message and exit
Use the terminal listing to compare the concise command with the structured usage information it produces. section 1.7
