diff --git a/nvchecker/tools.py b/nvchecker/tools.py index 300bf22..c385e8a 100644 --- a/nvchecker/tools.py +++ b/nvchecker/tools.py @@ -31,3 +31,18 @@ def take(): oldvers[name] = newvers[name] core.write_verfile(s.oldver, oldvers) + +def cmp(): + parser = argparse.ArgumentParser(description='compare version records of nvchecker') + core.add_common_arguments(parser) + args = parser.parse_args() + if core.process_common_arguments(args): + return + + s = core.Source(args.file) + oldvers = core.read_verfile(s.oldver) if s.oldver else {} + newvers = core.read_verfile(s.newver) + for name, newver in sorted(newvers.items()): + oldver = oldvers.get(name, None) + if oldver != newver: + print('%s %s -> %s' % (name, oldver, newver)) diff --git a/setup.py b/setup.py index bede8ac..c228be4 100755 --- a/setup.py +++ b/setup.py @@ -13,6 +13,7 @@ setup( 'console_scripts': [ 'nvchecker = nvchecker.main:main', 'nvtake = nvchecker.tools:take', + 'nvcmp = nvchecker.tools:cmp', ], },