From abdfbc673efa4abb68d5208fbfb6c3aba50cfb31 Mon Sep 17 00:00:00 2001 From: Ian McEwen Date: Sun, 30 Jun 2024 16:52:31 -0700 Subject: [PATCH] Allow connection args without an argument, add argument aliases --- meshtastic/__main__.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 93b3ba9..cc9cff0 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -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.') group = outer.add_mutually_exclusive_group() group.add_argument( - "--port", - help="The port of the device to connect to using serial, e.g. /dev/ttyUSB0.", + "--port", "--serial", "-s", + 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, ) group.add_argument( - "--host", - help="The hostname or IP address of the device to connect to using TCP", + "--host", "--tcp", "-t", + help="Connect to a device using TCP, optionally passing hostname or IP address to use. (defaults to '%(const)s')", + nargs="?", default=None, + const="localhost" ) group.add_argument( - "--ble", - help="Connect to a BLE device, optionally specifying a device name (defaults to 'any')", + "--ble", "-b", + help="Connect to a BLE device, optionally specifying a device name (defaults to '%(const)s')", nargs="?", default=None, const="any"