capra

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 15 Imported by: 0

README

capra

Convert between JSON, YAML and TOML.

Features

  • Pretty output with syntax highlighting
  • Lots of highlighting style (using chroma)

Intallation

Run go install:

$ go install github.com/9yokuro/capra@latest

Or Download the binary from the release page

Usage

$ capra --help

Usage of capra:
  -f, --format string   Set the output format (default "json")
  -H, --no-highlight    Disable syntax highlighting
  -s, --style string    Set the highlight style (default "monokai")
  -v, --version         Print version

To output converted data to stdout:

$ capra --format=json foo.yaml bar.toml

You can use pipe:

$ echo '{ "foo": "bar" }' | capra --format=yaml

foo: bar

[!NOTE] When you redirect to a file or use capra with another software such as jq, you MUST specify the option --no-highlight.

To write converted data to a file:

$ capra --format=json --no-highlight foo.yaml bar.toml > baz.json

With jq:

$ echo '{ "foo": [ { "bar": "baz" } ] }' | capra --format=json --no-highlight | jq -r '.foo[].bar'

baz

Available format

  • JSON
  • YAML
  • TOML

Available style

See Chroma Style Gallery.

License

This project is licensed under the MIT License.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL