From a04b3498b348c4b34507cc5d81309b5bd64941ee Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sun, 30 Jun 2024 06:54:29 -0700 Subject: [PATCH] make specifying an argument to --seriallog optional thanks @ianmcorvidae for telling me about the cool nargs='?' option! --- .vscode/launch.json | 2 +- meshtastic/__main__.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index aca86dde..b9195509 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -164,7 +164,7 @@ "request": "launch", "module": "meshtastic", "justMyCode": true, - "args": ["--debug", "--seriallog", "stdout"] + "args": ["--debug", "--seriallog"] }, { "name": "meshtastic test", diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 781f6bf9..2f5ef2fa 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -1170,7 +1170,10 @@ def initParser(): group.add_argument( "--seriallog", - help="Log device serial output to either 'stdout', 'none' or a filename to append to.", + help="Log device serial output to either 'none' or a filename to append to. Defaults to 'stdout' if no filename specified.", + nargs='?', + const="stdout", + default=None ) group.add_argument(