provide shortcut for the proto file path option

This commit is contained in:
Brian S. Stephan 2023-06-20 15:45:31 -05:00
parent 35abad327e
commit 518aae359d
Signed by: bss
GPG Key ID: 3DE06D3180895FCB
2 changed files with 3 additions and 5 deletions

View File

@ -36,9 +36,7 @@ from the main GP2040-CE project, e.g. pointing this tool at your clone of the co
this would suffice for a working invocation (note: you do not need to compile the files yourself):
```
% visualize-storage --proto-files-path=~/proj/GP2040-CE/proto \
--proto-files-path=~/proj/GP2040-CE/lib/nanopb/generator/proto \
memory.bin
% visualize-storage -P ~/proj/GP2040-CE/proto -P ~/proj/GP2040-CE/lib/nanopb/generator/proto memory.bin
```
(In the future we will look into publishing complete packages that include the compiled `_pb2.py` files, so that you
@ -47,7 +45,7 @@ don't need to provide them yourself.)
Sample output:
```
% visualize-storage --proto-files-path=~/proj/GP2040-CE/proto --proto-files-path=~/proj/GP2040-CE/lib/nanopb/generator/proto ~/proj/GP2040-CE/demo-memory.bin
% visualize-storage -P ~/proj/GP2040-CE/proto -P ~/proj/GP2040-CE/lib/nanopb/generator/proto ~/proj/GP2040-CE/demo-memory.bin
boardVersion: "v0.7.2"
gamepadOptions {
inputMode: INPUT_MODE_HID

View File

@ -22,7 +22,7 @@ logger = logging.getLogger(__name__)
# parse flags that are common to many tools (e.g. adding paths for finding .proto files)
core_parser = argparse.ArgumentParser(add_help=False)
core_parser.add_argument('-v', '--version', action='version', version=f"%(prog)s {__version__}")
core_parser.add_argument('--proto-files-path', type=pathlib.Path, default=list(), action='append',
core_parser.add_argument('-P', '--proto-files-path', type=pathlib.Path, default=list(), action='append',
help="path to .proto files to read, including dependencies; you will likely need "
"to supply this twice, once for GP2040-CE's .proto files and once for nanopb's")
args, _ = core_parser.parse_known_args()