Mercurial > hg > config
view python/example/ymldiff.py @ 847:6c918c07d0e3
[gpg] make a front-end to add a line to a gpg symmetrically encrypted file
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Tue, 17 Oct 2017 11:59:09 -0700 |
parents | 48ea50d346de |
children |
line wrap: on
line source
#!/usr/bin/env python # XXX/TODO: # I have no idea where this dependency comes from; on one hand, it sounds # awesome! On another hand, it should, at the very least, be documented import datadiff import optparse import sys import yaml def main(args=sys.argv[1:]): usage = '%prog [options] from.yml to.yml' parser = optparse.OptionParser(usage=usage) options, args = parser.parse_args() if len(args) != 2: parser.error("Please supply two .yml files") # compare the output output0 = yaml.load(file(args[0])) output1 = yaml.load(file(args[1])) diff = datadiff.diff(output0, output1, context=1, fromfile=args[0], tofile=args[1]) print diff if __name__ == '__main__': main()