add click option for --safety-ignore instead of parsing it out of args

This commit is contained in:
Erin O'Connell
2018-06-24 22:46:03 -06:00
parent 734398e336
commit b736708ee7
2 changed files with 18 additions and 9 deletions
+14 -2
View File
@@ -694,6 +694,12 @@ def run(command, args, three=None, python=False):
default=False,
help="Given a code path, show potentially unused dependencies.",
)
@option(
'--safety-ignore',
is_flag=True,
default=False,
help="Ignore specified packages when doing the safety check"
)
@argument('args', nargs=-1)
def check(
three=None,
@@ -701,12 +707,18 @@ def check(
system=False,
unused=False,
style=False,
safety_ignore=False,
args=None,
):
from .core import do_check
print(safety_ignore)
do_check(
three=three, python=python, system=system, unused=unused, args=args
three=three,
python=python,
system=system,
unused=unused,
safety_ignore=safety_ignore,
args=args
)
+4 -7
View File
@@ -2338,7 +2338,7 @@ def do_run(command, args, three=None, python=False):
do_run_posix(script, command=command)
def do_check(three=None, python=False, system=False, unused=False, args=None):
def do_check(three=None, python=False, system=False, unused=False, safety_ignore=False,args=None):
if not system:
# Ensure that virtualenv is available.
ensure_project(three=three, python=python, validate=False, warn=False)
@@ -2409,12 +2409,9 @@ def do_check(three=None, python=False, system=False, unused=False, args=None):
python = which('python')
else:
python = system_which('python')
try:
if '--safety-ignore' in args[0]:
ignore = '-i ' + ' -i'.join(args[1:])
else:
ignore = ''
except IndexError:
if safety_ignore:
ignore = '-i ' + ' -i '.join(args)
else:
ignore = ''
c = delegator.run(
'"{0}" {1} check --json --key=1ab8d58f-5122e025-83674263-bc1e79e0 {2}'.format(