1
0
angie-conv-image/jinja2/j2-single.py

31 lines
608 B
Python
Raw Normal View History

2024-07-16 02:43:08 +03:00
#!/usr/bin/env python3
import os.path
import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import j2common
def main():
if len(sys.argv) < 2:
raise ValueError('not enough arguments (min: 1)')
if len(sys.argv) > 3:
raise ValueError('too many arguments (max: 2)')
if not sys.argv[1]:
raise ValueError('specify input file')
if len(sys.argv) == 3:
if not sys.argv[2]:
raise ValueError('specify output file')
j2common.init()
j2common.render_file(*sys.argv[1:])
sys.exit(0)
if __name__ == "__main__":
main()