# HG changeset patch # User Jeff Hammel # Date 1477699535 25200 # Node ID 4adc11d68e3d82028a9ec1c66d94b65844849a9c # Parent 624a7fc0d7caa9be5635e004dd2bd7f9acea48c7 mostly formatting diff -r 624a7fc0d7ca -r 4adc11d68e3d python/diffex.py --- a/python/diffex.py Fri Oct 28 17:01:54 2016 -0700 +++ b/python/diffex.py Fri Oct 28 17:05:35 2016 -0700 @@ -2,9 +2,11 @@ # -*- coding: utf-8 -*- """ -diff before v after of executables (requires http://k0s.org/hg/config/file/f71f6ffa731a/python/lsex.py) +diff before v after of executables +(requires http://k0s.org/hg/config/file/f71f6ffa731a/python/lsex.py) """ +# improts import difflib import lsex import optparse @@ -13,12 +15,14 @@ import sys import tempfile + def add_options(parser): """add options to the OptionParser instance""" + def main(args=sys.argv[1:]): - # parse command line options + # parse command line usage = '%prog [options] ...' class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): """description formatter for console script entry point""" @@ -27,10 +31,12 @@ return description.strip() + '\n' else: return '' - parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) + parser = optparse.OptionParser(usage=usage, + description=__doc__, + formatter=PlainDescriptionFormatter()) options, args = parser.parse_args(args) - # get difference + # get difference in executables before = lsex.executable_names() # get executables before raw_input("Press [Enter] to continue") after = lsex.executable_names() # get executables after @@ -48,7 +54,8 @@ for display_name, var in display: if var: print '%s:' % display_name - print '\n'.join(var) + print ('\n'.join(var)) + if __name__ == '__main__': main()