summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2014-06-18 13:26:04 +0100
committerJose Fonseca <jfonseca@vmware.com>2014-06-18 13:26:04 +0100
commitaeec2ba4f6aa03429e820999be7ea7e47cd4b533 (patch)
treecb286561158673a8eeeb0a87c45fbf84f958cc0e
parent18178e0035f603b68490f42672566d3adb33bead (diff)
jsondiff: Add --ignore-added option; fix option parsing.
-rwxr-xr-xscripts/jsondiff.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/jsondiff.py b/scripts/jsondiff.py
index bd45fdba..8719cd58 100755
--- a/scripts/jsondiff.py
+++ b/scripts/jsondiff.py
@@ -301,6 +301,10 @@ def main():
optparser = optparse.OptionParser(
usage="\n\t%prog [options] <ref_json> <src_json>")
optparser.add_option(
+ '--ignore-added',
+ action="store_true", dest="ignore_added", default=False,
+ help="ignore added state")
+ optparser.add_option(
'--keep-images',
action="store_false", dest="strip_images", default=True,
help="compare images")
@@ -310,14 +314,14 @@ def main():
if len(args) != 2:
optparser.error('incorrect number of arguments')
- a = load(open(sys.argv[1], 'rt'), options.strip_images)
- b = load(open(sys.argv[2], 'rt'), options.strip_images)
+ a = load(open(args[0], 'rt'), options.strip_images)
+ b = load(open(args[1], 'rt'), options.strip_images)
if False:
dumper = Dumper()
dumper.visit(a)
- differ = Differ()
+ differ = Differ(ignore_added = options.ignore_added)
differ.visit(a, b)