Skip to content

Commit

Permalink
make --q-xxx mutually-exclusive with --iava & --stdin & CVE args #58
Browse files Browse the repository at this point in the history
  • Loading branch information
ryran committed Dec 1, 2016
1 parent 7a0c7de commit 3e8e8da
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions rhsecapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
prog = 'rhsecapi'
vers = {}
vers['version'] = '1.0.0_rc8'
vers['date'] = '2016/11/29'
vers['date'] = '2016/12/01'


# Logging
Expand Down Expand Up @@ -307,9 +307,12 @@ def parse_args():
o.doSearch = False
else:
o.doSearch = True
# if o.q_iava and o.doSearch:
# logger.error("The --q-iava option is incompatible with other --q-xxx options; it can only be used alone")
# sys.exit(1)
if o.iavas:
print("{0}: error: --q-xxx options not allowed in concert with -i/--iava".format(prog), file=sys.stderr)
sys.exit(1)
if o.cves or o.stdin:
print("{0}: error: --q-xxx options not allowed in concert with CVE args".format(prog), file=sys.stderr)
sys.exit(1)
if o.cves:
o.cves = rhsda.extract_cves_from_input(o.cves, "cmdline")
if not o.cves:
Expand All @@ -319,7 +322,7 @@ def parse_args():
o.cves.extend(found)
# If no search (--q-xxx) and no CVEs mentioned
if not o.showUsage and not (o.doSearch or o.cves or o.iavas):
logger.error("Must specify a search to perform (one of the --q-xxx opts) or CVEs or IAVAs to retrieve")
logger.error("Must specify CVEs/IAVAs to retrieve or a search to perform (--q-xxx opts)")
o.showUsage = True
if o.showUsage:
p.print_usage()
Expand Down

0 comments on commit 3e8e8da

Please sign in to comment.