Added parameter to output known device list.

This commit is contained in:
Markus Birth 2019-09-16 12:45:58 +02:00
parent 319197c88b
commit 7959ac4776
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A

View File

@ -9,6 +9,7 @@ __author__ = "mbirth"
from grmn import updateserver, devices
from optparse import OptionParser, OptionGroup
import json
import os.path
import sys
@ -33,7 +34,17 @@ Examples:
(opts, device_skus) = optp.parse_args()
if len(device_skus) < 1 and not opts.devicexml:
if opts.list_devices:
if opts.json:
print(json.dumps(devices.DEVICES))
else:
print("HWID - Device/Component")
for hwid, name in devices.DEVICES.items():
print("{:>04} - {}".format(hwid, name))
print()
print("SKU format is 006-Bxxxx-00 with xxxx being the HWID.")
sys.exit(0)
elif len(device_skus) < 1 and not opts.devicexml:
optp.print_help()
sys.exit(1)