Skip to content

Releases: sayanarijit/jf

v0.6.2

01 Jun 06:44
v0.6.2
d94e9fd
Compare
Choose a tag to compare
Minor cleanups and test fixes

v0.6.1

28 May 06:19
v0.6.1
241caaf
Compare
Choose a tag to compare
- Added CLI option -f, --file to read template from file
- `-` will act like an alias for `-f -`

v0.6.0

28 May 04:40
v0.6.0
0f4b231
Compare
Choose a tag to compare
- 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

27 May 19:10
v0.5.0
178b289
Compare
Choose a tag to compare
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

27 May 16:53
v0.4.2
cbbd746
Compare
Choose a tag to compare

Added support for control placeholders.

  • %R enable raw mode - render but do not format output
  • %Y enable pretty YAML mode - format output into pretty YAML
  • %J enable 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

27 May 11:55
v0.4.1
6e85ea9
Compare
Choose a tag to compare
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

27 May 06:39
v0.4.0
b7fb344
Compare
Choose a tag to compare
- 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

24 May 15:29
v0.3.3
96a8fcc
Compare
Choose a tag to compare
Minor fix in usage test

v0.3.2

24 May 15:22
v0.3.2
e144c97
Compare
Choose a tag to compare
  • Use ${NAME?}q/$(NAME?)s syntax to define nullable placeholder.
  • As opposed to optional placeholders that defaults to blank, nullable
    placeholders will default to null.
  • 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]

v0.3.1

21 May 10:45
v0.3.1
1ddbe9f
Compare
Choose a tag to compare
Improve man page