Fix argparse mutually exclusive group members
authorLingchao Xin <lingchaox.xin@intel.com>
Thu, 2 Jan 2014 07:07:45 +0000 (15:07 +0800)
committerLingchao Xin <lingchaox.xin@intel.com>
Thu, 2 Jan 2014 07:07:58 +0000 (15:07 +0800)
Change-Id: Id404ff577d1c09ed0f475ecd1d17342b0407f482

tools/snap-diff

index a5f4c0b0b35daf98c901d37bb8365ae06f377f01..5dd60135a70c73ffb2a6273ff4d3e48e8a6e67f1 100755 (executable)
@@ -11,14 +11,14 @@ def main(argv):
     parser = argparse.ArgumentParser(description=description)
     parser.add_argument(dest='old', help='old repo')
     parser.add_argument(dest='new', help='new repo')
-    parser.add_argument('--json', help='output json diffs', action='store_true')
+    parser.add_argument('-t', dest='type', default='repo', help="which diff you want(repo | image, default is repo)")
     group = parser.add_mutually_exclusive_group()
-    group.add_argument('-t', dest='type', default='repo', help="which diff you want(repo | image, default is repo)")
+    group.add_argument('--json', help='output json diffs', action='store_true')
     group.add_argument('-d', dest='directory', help="Output html diffs into the directory")
     args = parser.parse_args(argv)
 
     if args.directory:
-        snapdiff.diff_to_dist(args.old, args.new, args.directory, style=args.type or 'repo')
+        snapdiff.diff_to_dist(args.old, args.new, args.directory, style=args.type)
         print "Diff between '%s' and '%s' has been ready in %s" % (args.old, args.new, args.directory)
     elif args.json:
         print snapdiff.diff_to_JSON(args.old, args.new, style=args.type)