1
0
mirror of https://github.com/mbirth/tcl_ota_check.git synced 2024-11-09 22:06:47 +00:00

enable multiple prd filtering for findprd

This commit is contained in:
thurask 2018-06-30 11:42:00 -04:00
parent 4be09b5b3b
commit 375a87c4b8
No known key found for this signature in database
GPG Key ID: A6CCCDEA29795048

View File

@ -18,7 +18,7 @@ dpdesc = """
can be set by floor and ceiling switches. can be set by floor and ceiling switches.
""" """
dp = argparser.DefaultParser(__file__, dpdesc) dp = argparser.DefaultParser(__file__, dpdesc)
dp.add_argument("tocheck", help="CU Reference # to filter scan results", nargs="?", default=None) dp.add_argument("tocheck", help="CU Reference #(s) to filter scan results", nargs="*", default=None)
dp.add_argument("-f", "--floor", help="Beginning of scan range", dest="floor", nargs="?", type=int, default=0) dp.add_argument("-f", "--floor", help="Beginning of scan range", dest="floor", nargs="?", type=int, default=0)
dp.add_argument("-c", "--ceiling", help="End of scan range", dest="ceiling", nargs="?", type=int, default=999) dp.add_argument("-c", "--ceiling", help="End of scan range", dest="ceiling", nargs="?", type=int, default=999)
dp.add_argument("-l", "--local", help="Force using local database", dest="local", action="store_true", default=False) dp.add_argument("-l", "--local", help="Force using local database", dest="local", action="store_true", default=False)
@ -46,13 +46,16 @@ for prdc in prdx:
prddict[key].append(value) prddict[key].append(value)
if args.tocheck is not None: if args.tocheck is not None:
args.tocheck = args.tocheck.replace("APBI-PRD", "").replace("PRD-", "") if not isinstance(args.tocheck, list):
args.tocheck = [args.tocheck]
args.tocheck = [toch.replace("APBI-PRD", "").replace("PRD-", "") for toch in args.tocheck]
prdkeys = list(prddict.keys()) prdkeys = list(prddict.keys())
for k in prdkeys: for k in prdkeys:
if k != args.tocheck: if k not in args.tocheck:
del prddict[k] del prddict[k]
if not prddict: for toch in args.tocheck:
prddict[args.tocheck] = [] if toch not in prddict.keys():
prddict[toch] = []
dev = DesktopDevice() dev = DesktopDevice()