| Crates.io | hbsenvsubst |
| lib.rs | hbsenvsubst |
| version | 0.0.2 |
| created_at | 2021-01-15 22:48:28.561423+00 |
| updated_at | 2021-01-15 23:31:03.572976+00 |
| description | Substitutes the values of environment variables, but with handlebars. |
| homepage | https://github.com/atsjj/hbsenvsubst |
| repository | https://github.com/atsjj/hbsenvsubst |
| max_upload_size | |
| id | 342601 |
| size | 35,081 |
Substitutes the values of environment variables, but with handlebars.
Basically the idea of hbsenvsubst is to work similar to envsubst, but instead of using
shell format, it uses handlebars.
Please be aware that at this time, hbsenvsubst should be considered a prototype that was quickly
rushed to play with this idea, so your mileage may vary.
hbsenvsubst < some-file-in > some-file-out
An example handlebars input like this:
#!/bin/bash
echo "hello {{env.USER}}"
should yield hello foo, given that the USER environment variable is "foo".
There are currently three objects accessible in handlebars:
env - environment variablesmemfree - free system memorytotal - total system memoryused - used system memorycpulogical - number of logical cpusphysical - number of physical cpusIn addition to this, there are some additional helpers:
add - add{{add 2 2}} yields 4div - divide{{div 4 2}} yields 2mod - modulo{{mod 4 3}} yields 1mul - multiply{{mul 3 3}} yields 9sub - subtract{{sub 8 5}} yields 3The rust-handlebars crate also includes some built-in helpers:
ifunlesslogeachwitheqnegtgteltlteandornotMIT License