From 518aae359d4c2354d1e64e32cb78dc644760f6e4 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Tue, 20 Jun 2023 15:45:31 -0500 Subject: [PATCH] provide shortcut for the proto file path option --- README.md | 6 ++---- gp2040ce_bintools/__init__.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 621a21c..1f34aec 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/gp2040ce_bintools/__init__.py b/gp2040ce_bintools/__init__.py index 53ee1d0..6f72632 100644 --- a/gp2040ce_bintools/__init__.py +++ b/gp2040ce_bintools/__init__.py @@ -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()