File indexing completed on 2025-01-05 04:00:26
0001 #!/usr/bin/env python3 0002 0003 import json 0004 import sys 0005 import os 0006 import shutil 0007 import argparse 0008 sys.path.insert(0, os.path.join( 0009 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 0010 "lib" 0011 )) 0012 from lottie.utils.linediff import difflines 0013 from lottie.objects import Animation 0014 from lottie.parsers.tgs import parse_tgs 0015 from lottie import __version__ 0016 0017 0018 parser = argparse.ArgumentParser( 0019 description="Shows a side-by-side diff of the human-readable rendition of two tgs / lottie files", 0020 ) 0021 parser.add_argument("--version", "-v", action="version", version="%(prog)s - python-lottie " + __version__) 0022 parser.add_argument( 0023 "file1", 0024 help="Left file" 0025 ) 0026 parser.add_argument( 0027 "file2", 0028 help="Right file" 0029 ) 0030 0031 if __name__ == "__main__": 0032 ns = parser.parse_args() 0033 width = shutil.get_terminal_size((-1, -1)).columns 0034 if width < 10: 0035 width = None 0036 else: 0037 width = int((width - 3) / 2) 0038 a1 = parse_tgs(ns.file1) 0039 a2 = parse_tgs(ns.file2) 0040 difflines(a1, a2, width, width)