Skip to content

Commit 98b7a7d

Browse files
authored
Merge pull request #625 from ianmcorvidae/nargs2
Allow connection args without an argument, add argument aliases
2 parents 42ea29b + abdfbc6 commit 98b7a7d

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

meshtastic/__main__.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,20 +1101,24 @@ def addConnectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParse
11011101
outer = parser.add_argument_group('Connection', 'Optional arguments that specify how to connect to a Meshtastic device.')
11021102
group = outer.add_mutually_exclusive_group()
11031103
group.add_argument(
1104-
"--port",
1105-
help="The port of the device to connect to using serial, e.g. /dev/ttyUSB0.",
1104+
"--port", "--serial", "-s",
1105+
help="The port of the device to connect to using serial, e.g. /dev/ttyUSB0. (defaults to trying to detect a port)",
1106+
nargs="?",
1107+
const=None,
11061108
default=None,
11071109
)
11081110

11091111
group.add_argument(
1110-
"--host",
1111-
help="The hostname or IP address of the device to connect to using TCP",
1112+
"--host", "--tcp", "-t",
1113+
help="Connect to a device using TCP, optionally passing hostname or IP address to use. (defaults to '%(const)s')",
1114+
nargs="?",
11121115
default=None,
1116+
const="localhost"
11131117
)
11141118

11151119
group.add_argument(
1116-
"--ble",
1117-
help="Connect to a BLE device, optionally specifying a device name (defaults to 'any')",
1120+
"--ble", "-b",
1121+
help="Connect to a BLE device, optionally specifying a device name (defaults to '%(const)s')",
11181122
nargs="?",
11191123
default=None,
11201124
const="any"

0 commit comments

Comments
 (0)