Skip to content

Commit 3d05b55

Browse files
committed
api: fix parser.exit() handling with no arguments
That are meant to truncate the scanning procedure.
1 parent 48e379f commit 3d05b55

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/pkgcheck/api.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ def scan(args=None, /, *, base_args=None):
2525
from .pipeline import Pipeline
2626
from .scripts import pkgcheck
2727

28-
def parser_exit(parser, status, message):
29-
"""Stub function to handle argparse errors."""
30-
raise PkgcheckException(message.strip())
28+
def parser_exit(parser, status=0, message=None):
29+
"""Stub function to handle argparse errors.
30+
31+
Exit calls with no message arguments signify truncated scans, i.e. no
32+
restriction targets are specified.
33+
"""
34+
if message:
35+
raise PkgcheckException(message.strip())
3136

3237
if args is None:
3338
args = []

0 commit comments

Comments
 (0)