make specifying an argument to --seriallog optional

thanks @ianmcorvidae for telling me about the cool nargs='?' option!
This commit is contained in:
Kevin Hester
2024-06-30 06:54:29 -07:00
parent 18c2d08bf0
commit a04b3498b3
2 changed files with 5 additions and 2 deletions

2
.vscode/launch.json vendored
View File

@@ -164,7 +164,7 @@
"request": "launch",
"module": "meshtastic",
"justMyCode": true,
"args": ["--debug", "--seriallog", "stdout"]
"args": ["--debug", "--seriallog"]
},
{
"name": "meshtastic test",

View File

@@ -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(