github.com/mickep76/jtree

CLI tool for printing JSON as a tree in the terminal


License
Other
Install
go get github.com/mickep76/jtree

Documentation

jtree

CLI tool for printing JSON as a tree or key-value list in the terminal

Usage

jtree

Usage:
  jtree <uri> [--debug] [--refs] [--trunc] [--filter=<path>] [--cert=<cert-file>] [--key=<key-file>] [--ca=<ca-file>] [--insecure]
  jtree -h | --help
  jtree --version

Arguments:
  uri                   URI for JSON file will assume "file://" if there is no prefix or use "-" for stdin.

Options:
  -h --help             Show this screen.
  --version             Show version.
  -d --debug            Debug.
  -r --refs             Resolve JSON references.
  -t --trunc            Truncate strings over 40 characters.
  -f --filter=<path>    Filter path (uses pointer format /<key>).
  -C --cert=<cert-file> Certificate file for client authentication.
  -K --key=<key-file>   Key file for client client authentication.
  --ca=<ca-file>        CA file for TLS client authentication.
  -k --insecure         Insecure, won't verify SSL certificate.

Examples:

docker images -q | tail -1 | xargs docker inspect | jtree -

/
└── 0
    ├── Architecture: amd64
    ├── Author:
    ├── Comment:
    ├── Config
    │   ├── AttachStderr: false
    │   ├── AttachStdin: false
...
jtree https://raw.githubusercontent.com/imc-trading/dock2box/master/config/schemas/all.json --refs

/
├── $schema: http://json-schema.org/draft-04/schema#
├── additionalProperties: false
├── properties
│   ├── hosts
│   │   ├── $schema: http://json-schema.org/draft-04/schema#
│   │   ├── additionalProperties: false
│   │   ├── patternProperties
│   │   │   └── .+
│   │   │       ├── $schema: http://json-schema.org/draft-04/schema#
│   │   │       ├── definitions
...

Install using Homebrew on Mac OS X

brew tap mickep76/funk-gnarge
brew install jtree

Upgrade

brew update
brew upgrade --all

Install using RPM on RedHat based distros

Go to the release section there are pre-built RPM releases for any RedHat based distro.

Build binary

git clone https://github.com/mickep76/jtree.git
cd jtree
make

Build RPM

Make sure you have Docker configured.

git clone https://github.com/mickep76/jtree.git
cd jtree
make rpm

TODO

  • Assumes references are map[string]interface{} when it could be anything
  • Doesn't handle circular references
  • Set request headers to JSON