nargs='?' is awesome! get rid of ble_dest.

This commit is contained in:
Kevin Hester
2024-06-30 06:46:39 -07:00
parent 7e440693a3
commit 5c2851db85
2 changed files with 5 additions and 9 deletions

2
.vscode/launch.json vendored
View File

@@ -10,7 +10,7 @@
"request": "launch",
"module": "meshtastic",
"justMyCode": false,
"args": ["--ble", "--ble-dest", "Meshtastic_9f6e"]
"args": ["--ble", "Meshtastic_9f6e"]
},
{
"name": "meshtastic BLE scan",

View File

@@ -1046,7 +1046,7 @@ def common():
print(f"Found: name='{x.name}' address='{x.address}'")
meshtastic.util.our_exit("BLE scan finished", 0)
elif args.ble:
client = BLEInterface(args.ble_dest, debugOut=logfile, noProto=args.noproto, noNodes=args.no_nodes)
client = BLEInterface(args.ble if args.ble != "any" else None, debugOut=logfile, noProto=args.noproto, noNodes=args.no_nodes)
elif args.host:
try:
client = meshtastic.tcp_interface.TCPInterface(
@@ -1114,14 +1114,10 @@ def addConnectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParse
group.add_argument(
"--ble",
help="The BLE device address or name to connect to",
action="store_true",
)
outer.add_argument(
"--ble-dest",
help="The BLE device address or name to connect to",
help="Connect to a BLE device, optionally specifying a device name (defaults to 'any')",
nargs="?",
default=None,
const="any"
)
return parser