From b11d357d9ac7064ab4f0da380a2c3b9497482aa5 Mon Sep 17 00:00:00 2001 From: Pranav Srinivas Kumar Date: Mon, 1 Apr 2019 20:52:36 -0400 Subject: [PATCH] Update README.md --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 154c622..64288a4 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,22 @@ $ ./main --verbose 4 The square of 4 is 16 ``` +### Printing Help + +```ArgumentParser.print_help()``` print a help message, including the program usage and information about the arguments registered with the ArgumentParser. For the previous example, here's the default help message: + +```bash +$ ./main --help +Usage: ./main [options] square + +Positional arguments: +square display a square of a given number + +Optional arguments: +-h, --help show this help message and exit +-v, --verbose enable verbose logging +``` + ### List of Arguments ArgumentParser objects usually associate a single command-line argument with a single action to be taken. The ```.nargs``` associates a different number of command-line arguments with a single action. When using ```nargs(N)```, N arguments from the command line will be gathered together into a list.