Allow connection args without an argument, add argument aliases

This commit is contained in:
Ian McEwen
2024-06-30 16:52:31 -07:00
parent 42ea29be8f
commit abdfbc673e

View File

@@ -1101,20 +1101,24 @@ def addConnectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParse
outer = parser.add_argument_group('Connection', 'Optional arguments that specify how to connect to a Meshtastic device.') outer = parser.add_argument_group('Connection', 'Optional arguments that specify how to connect to a Meshtastic device.')
group = outer.add_mutually_exclusive_group() group = outer.add_mutually_exclusive_group()
group.add_argument( group.add_argument(
"--port", "--port", "--serial", "-s",
help="The port of the device to connect to using serial, e.g. /dev/ttyUSB0.", help="The port of the device to connect to using serial, e.g. /dev/ttyUSB0. (defaults to trying to detect a port)",
nargs="?",
const=None,
default=None, default=None,
) )
group.add_argument( group.add_argument(
"--host", "--host", "--tcp", "-t",
help="The hostname or IP address of the device to connect to using TCP", help="Connect to a device using TCP, optionally passing hostname or IP address to use. (defaults to '%(const)s')",
nargs="?",
default=None, default=None,
const="localhost"
) )
group.add_argument( group.add_argument(
"--ble", "--ble", "-b",
help="Connect to a BLE device, optionally specifying a device name (defaults to 'any')", help="Connect to a BLE device, optionally specifying a device name (defaults to '%(const)s')",
nargs="?", nargs="?",
default=None, default=None,
const="any" const="any"