29 lines
599 B
Python
29 lines
599 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
import os.path
|
||
|
import sys
|
||
|
|
||
|
|
||
|
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) and (not sys.argv[2]):
|
||
|
raise ValueError('specify output file')
|
||
|
|
||
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||
|
import j2cfg
|
||
|
|
||
|
r = j2cfg.J2cfg()
|
||
|
r.render_file(*sys.argv[1:])
|
||
|
sys.exit(0)
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
main()
|