added -s option to show diff in a browser
This commit is contained in:
parent
d6b00ca790
commit
64d513dde6
2 changed files with 15 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
index.html
|
||||||
|
test/
|
||||||
|
venv/
|
||||||
|
|
@ -394,11 +394,21 @@ def main(fromfile, tofile, verbose=False):
|
||||||
codeDiff.write()
|
codeDiff.write()
|
||||||
|
|
||||||
|
|
||||||
|
def show():
|
||||||
|
import os
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
|
path = os.path.abspath('index.html')
|
||||||
|
webbrowser.open('file://' + path)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
description = """Given two source files this application\
|
description = """Given two source files this application\
|
||||||
creates an html page which highlights the differences between the two. """
|
creates an html page which highlights the differences between the two. """
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description=description)
|
parser = argparse.ArgumentParser(description=description)
|
||||||
|
parser.add_argument('-s', '--show', action='store_true',
|
||||||
|
help='show html in a browser.')
|
||||||
parser.add_argument('-v', action='store_true', help='show verbose output.')
|
parser.add_argument('-v', action='store_true', help='show verbose output.')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'file1', help='source file to compare ("before" file).')
|
'file1', help='source file to compare ("before" file).')
|
||||||
|
|
@ -407,3 +417,5 @@ creates an html page which highlights the differences between the two. """
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
main(args.file1, args.file2, args.v)
|
main(args.file1, args.file2, args.v)
|
||||||
|
if args.show:
|
||||||
|
show()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue