From 59304820da6c9b414114ef84f78aaf0bab6cabe4 Mon Sep 17 00:00:00 2001 From: PhilipMay Date: Tue, 6 Jul 2021 16:11:44 +0200 Subject: [PATCH] change error communication to sys.exit #7 --- style_doc/style_doc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/style_doc/style_doc.py b/style_doc/style_doc.py index 1811fcd..2de47d2 100644 --- a/style_doc/style_doc.py +++ b/style_doc/style_doc.py @@ -542,11 +542,12 @@ def style_doc_files(*files, max_len=119, check_only=False, py_only=False, rst_on def main(*files, max_len=119, check_only=False, py_only=False, rst_only=False): if py_only and rst_only: print("You must not set --py_only and --rst_only at the same time.") - sys.exit(1) + sys.exit(2) changed = style_doc_files(*files, max_len=max_len, check_only=check_only, py_only=py_only, rst_only=rst_only) if check_only and len(changed) > 0: - raise ValueError(f"{len(changed)} files should be restyled!") + print(f"{len(changed)} files should be restyled!") + sys.exit(1) elif len(changed) > 0: print(f"Cleaned {len(changed)} files!")