J2CLI(1)

✨ J2CLI ✨

okay so bestie, gather round πŸ’– this is j2cli β€” the command line tool for templating in shell-scripts. yeah. templates. in your shell scripts. it's giving main character energy and honestly we're obsessed.


🌸 NAME 🌸

j2cli β€” command line tool for templating in shell-scripts πŸŽ€


πŸ’… DESCRIPTION πŸ’…

so here's the whole vibe, the usage line, exactly as it lives:

usage: j2 [-h] [-v] [-f {?,ini,json,yaml,env}] [-e VAR]

       [--filters python-file [python-file ...]]  [--tests python-file
       [python-file ...]] [--customize python-file.py] [--undefined] [-o
       outfile] template [data]

Command-line interface to Jinja2 for templating in shell scripts. that's it. that's the whole serve. Jinja2, but from your terminal, so your shell scripts can be cute AND dynamic πŸ’œ


πŸ¦‹ positional arguments πŸ¦‹

these are the ones you just... hand over. no flags, no ceremony, just vibes.

  • template β€” the template file to process. the blueprint. the moment. ✨
  • data β€” input data file path; "-" to use stdin. yes bestie, a literal dash "-" means read from stdin, iconic behavior honestly 🫢

πŸŽ€ optional arguments πŸŽ€

the flags. the little guys. every single one, no skipping, i don't make the rules πŸ’…

  • -h, --help β€” show this help message and exit. the classic. the moment you type it and immediately understand everything 🌈
  • -v, --version β€” show program's version number and exit. quick lil peek at who you're dealing with πŸ‘‘
  • -f {?,ini,json,yaml,env}, --format {?,ini,json,yaml,env} β€” input data format. that's the menu: ?, ini, json, yaml, env. pick your fighter πŸ“
  • -e VAR, --import-env VAR β€” import environment variables as var variable. use empty string to import into the top level. so like, if you want them tucked neatly under one name, name it. if you want them just... everywhere at the top level, empty string it is. no cap 🧚
  • --filters python-file [python-file ...] β€” load custom Jinja2 filters from a Python file: all top-level functions are imported. bring your own filters, bestie, the more the merrier πŸ’–
  • --tests python-file [python-file ...] β€” load custom Jinja2 tests from a Python file. same energy, but tests instead of filters ✨
  • --customize python-file.py β€” a Python file that implements hooks to fine-tune the j2cli behavior. yes you can literally customize the behavior. main character customization screen fr fr πŸ’…
  • --undefined β€” allow undefined variables to be used in templates (no error will be raised). so like, normally undefined variables will yell at you, and this flag tells them to chill 🫢
  • -o outfile β€” output to a file instead of stdout. instead of screaming into the terminal, it writes to a file. very demure, very mindful πŸŽ€
heads up bestie: --undefined means no error will be raised for undefined variables. that's the whole point of the flag, so don't come for me when it doesn't complain β€” that's the deal you made 😭

🌈 SEE ALSO 🌈

the full documentation for j2cli is maintained as a Texinfo manual. if the info and j2cli programs are properly installed at your site, the command

info j2cli

should give you access to the complete manual. go read it, it's giving scholarly πŸ“šβœ¨


and that's the whole page, bestie. this beauty is j2cli 0.3.12b0, running with Jinja2 2.11.3, dated September 2022 πŸŽ€ template responsibly, slay always, periodt πŸ’–πŸ‘‘πŸ¦‹

πŸ“¦ where this page comes from