add_argument() registers one command-line argument with an argparse parser. In a Django management command, call it inside add_arguments(), where BaseCommand supplies the parser. section 9.3
Configure each argument by supplying:
- A name: use leading dashes for a flag such as --last_name; omit them for a positional argument. section 9.3
- An optional short form, such as -l, followed by options including help text, defaults, and type conversion. section 9.3
- With only a name and help, the argument expects a string value after the flag. section 9.3
Filtering musicians
A musicians command can register --last_name/-l, --first_name/-f, and --birth/-b. Running python manage.py musicians --last_name Loblaw passes the value through options, where handle() can use it for filtering.
