kolypto / j2cli

Jinja2 Command-Line Tool, reworked
http://pypi.python.org/pypi/j2cli
BSD 2-Clause "Simplified" License
744 stars 82 forks source link

j2cli brokes drastically when `data` has no/invalid filename extensions #55

Open brlin-tw opened 4 years ago

brlin-tw commented 4 years ago

Reproduce

$ j2 template.j2 data
Traceback (most recent call last):
  File "/home/brlin/.local/bin/j2", line 8, in <module>
    sys.exit(main())
  File "/home/brlin/.local/pipx/venvs/j2cli/lib/python3.6/site-packages/j2cli/cli.py", line 206, in main
    sys.argv[1:]
  File "/home/brlin/.local/pipx/venvs/j2cli/lib/python3.6/site-packages/j2cli/cli.py", line 138, in render_command
    }[os.path.splitext(args.data)[1]]
KeyError: ''

Expected behavior

Version

j2cli 0.3.10, Jinja2 2.11.1
installed via pipx