aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass2024-07-17 16:56:57 +0100
committerSimon Glass2024-07-26 08:01:06 -0600
commit382c662c825416f875c082154e63a35532dab2e3 (patch)
tree82b58f91942e79966419bb60c27c944432c18fc9
parentfd385b3b013d13f567f3016c8c8da6667301b8ea (diff)
qconfig: Move arg checking to the top of main()
Check for 'test' as one of the possible operations for this tool, moving the check above the implementation. Signed-off-by: Simon Glass <sjg@chromium.org>
-rwxr-xr-xtools/qconfig.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/qconfig.py b/tools/qconfig.py
index 6d263ce30db..9052aedf57d 100755
--- a/tools/qconfig.py
+++ b/tools/qconfig.py
@@ -1524,6 +1524,10 @@ doc/develop/moveconfig.rst for documentation.'''
def main():
"""Main program"""
parser, args = parse_args()
+ if not any((args.force_sync, args.build_db, args.imply, args.find,
+ args.scan_source, args.test)):
+ parser.print_usage()
+ sys.exit(1)
if args.test:
sys.argv = [sys.argv[0]]
fail, _ = doctest.testmod()
@@ -1534,11 +1538,6 @@ def main():
col = terminal.Color(terminal.COLOR_NEVER if args.nocolour
else terminal.COLOR_IF_TERMINAL)
- if not any((args.force_sync, args.build_db, args.imply, args.find,
- args.scan_source)):
- parser.print_usage()
- sys.exit(1)
-
if args.scan_source:
do_scan_source(os.getcwd(), args.update)
return 0