]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
moveconfig: Tidy up imply flag parsing
authorSimon Glass <sjg@chromium.org>
Mon, 10 Jul 2017 20:47:46 +0000 (14:47 -0600)
committerTom Rini <trini@konsulko.com>
Sun, 23 Jul 2017 02:22:46 +0000 (22:22 -0400)
Add an option to specify 'all' to enable all flags. Also print an error
if an unrecognised flag is used. At present it just prints usage
information which is not very helpful.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/moveconfig.py

index eb4927f278ef95a05c88fa289611ff388310d8af..4fd9387c8449bc0d3161bf4a2f092e80a8b755a3 100755 (executable)
@@ -1886,14 +1886,21 @@ def main():
 
     if options.imply:
         imply_flags = 0
-        for flag in options.imply_flags.split():
-            if flag == 'help' or flag not in IMPLY_FLAGS:
-                print "Imply flags: (separate with ',')"
-                for name, info in IMPLY_FLAGS.iteritems():
-                    print ' %-15s: %s' % (name, info[1])
-                parser.print_usage()
-                sys.exit(1)
-            imply_flags |= IMPLY_FLAGS[flag][0]
+        if options.imply_flags == 'all':
+            imply_flags = -1
+
+        elif options.imply_flags:
+            for flag in options.imply_flags.split(','):
+                bad = flag not in IMPLY_FLAGS
+                if bad:
+                    print "Invalid flag '%s'" % flag
+                if flag == 'help' or bad:
+                    print "Imply flags: (separate with ',')"
+                    for name, info in IMPLY_FLAGS.iteritems():
+                        print ' %-15s: %s' % (name, info[1])
+                    parser.print_usage()
+                    sys.exit(1)
+                imply_flags |= IMPLY_FLAGS[flag][0]
 
         do_imply_config(configs, options.add_imply, imply_flags,
                         options.skip_added)