Releases: sayanarijit/jf
Releases · sayanarijit/jf
v1.0.0
v0.6.2
Minor cleanups and test fixes
v0.6.1
- Added CLI option -f, --file to read template from file - `-` will act like an alias for `-f -`
v0.6.0
- Use `jf -` to read template from stdin - Refactor the library, separating the CLI and template parsing logic. NOTE: We can either pass template or pass values from stdin, but not both.
v0.5.0
Added CLI options. This adds: -r, --raw output the raw rendered value without formatting -p, --pretty pretty print the output -y, --yaml output as YAML instead of JSON -h, --help print this help message -v, --version print the version number -- stop parsing options And removes: - `%v` - `%R` - `%Y` - `%J` Also the Rust library exposes more functions, each for different formatting options.
v0.4.2
Added support for control placeholders.
%Renable raw mode - render but do not format output%Yenable pretty YAML mode - format output into pretty YAML%Jenable pretty JSON mode - format output into pretty JSON
Example:
jf "%R%*q" a b c
"a","b","c"
jf "%Y[%*q]" a b c
- a
- b
- c
jf "%J[%*q]" a b c
[
"a",
"b",
"c"
]v0.4.1
To allow merging arrays and objects via expansion, trailing comma after `s` and
`q` will be auto removed after the expansion if no value is passed for the
placeholder.
Example:
```bash
jf "[%(a)*s, %(b)*s]" b=2 b=1
[2,1]
jf "{%(a)**s, %(b)**s}" b=2 b=1
{"2":1}
```
v0.4.0
- Use `%-s`, `%-q`, `%*-s`, `%*-q`, `%**-s`, `%**-q` syntax to read from stdin.
- Use `%(NAME@FILE)q` syntax to read default value from file.
- Use `%(NAME@-)q` syntax to read default value from stdin.
- Use `NAME@FILE` syntax to pass value for named placeholder from file.
- Use `NAME@-` syntax to pass value for named placeholder from stdin.
- Stdin values are separated by null (`\0`).
Examples:
```bash
seq 1 3 | xargs printf '%s\0' | jf '[%*-s]'
seq 1 3 | xargs printf '%s\0' | jf '{%q: %-s, %q: %(two)s, three: %(three@-)s}' one two two@-
```
Also, display better error for invalid expandable placeholder syntax.
v0.3.3
Minor fix in usage test
v0.3.2
- Use
${NAME?}q/$(NAME?)ssyntax to define nullable placeholder. - As opposed to optional placeholders that defaults to blank, nullable
placeholders will default tonull. - Useful for defining nullable string or array items.
Example:
jf "[str or bool, %(str)?q %(bool)?s, nullable, %(nullable?)q]" str=true
# ["str or bool","true","nullable",null]