utils/get-developers: use parser.error() rather than canned print+return

parser.error() reports a nice error message, that also displays a short
reminder of the available options.

Adapt the test-suite accordingly: previously, the error string was an
exact string in the stdout list, while it now is a substring in one of
the strings in stderr. The exit code changes, too.

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Julien Olivain <ju.o@free.fr>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Yann E. MORIN
2024-12-23 08:27:17 +01:00
committed by Julien Olivain
parent cdcb3f56e8
commit 35f381b93e
2 changed files with 8 additions and 10 deletions

View File

@@ -40,11 +40,9 @@ def __main__():
if len(args.patches) != 0:
action += 1
if action > 1:
print("Cannot do more than one action")
return
parser.error("Cannot do more than one action")
if action == 0:
print("No action specified")
return
parser.error("No action specified")
devs = getdeveloperlib.parse_developers(args.filename)
if devs is None: