Previously, pci_device used parser.parse_known_args() after adding custom parsers in each command class.
These parsers were disjoint from the parser declared and referenced in main. The main parser, however, was
responsible for creating the command help. The result was that the commands' options were not reflected
in the help output.
Moving to argparse subparsers corrects the problem, so that all options are visible from the main parser's
help printout.
positional arguments:
values show, print, all, off, \<int> \<int>
optional arguments:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
file to store values for show/print
-i INPUT, --input INPUT
file to read values from
Collateral (docs, reports, design examples, case IDs):
Description
Previously, pci_device used parser.parse_known_args() after adding custom parsers in each command class. These parsers were disjoint from the parser declared and referenced in main. The main parser, however, was responsible for creating the command help. The result was that the commands' options were not reflected in the help output.
Moving to argparse subparsers corrects the problem, so that all options are visible from the main parser's help printout.
Here's an example: # pci_device 0000:dc:00.0 aer mask --help usage: pci_device device-filter aer mask [-h] [-o OUTPUT] [-i INPUT] [values ...]
positional arguments: values show, print, all, off, \<int> \<int>
optional arguments: -h, --help show this help message and exit -o OUTPUT, --output OUTPUT file to store values for show/print -i INPUT, --input INPUT file to read values from
Collateral (docs, reports, design examples, case IDs):
N/A
Tests added:
Tests run:
Manual execution of all pci_device commands and manual inspection of help output.