Skip to content

A simple formatting cli that converts json, yaml or csv into tables using the rich library

License

Notifications You must be signed in to change notification settings

nishant-dash/rtab

Repository files navigation

rtab
rtab - Rich Tabulator

A simple formatting cli that converts json, yaml or csv into tables using the rich library.

Installation      rich-tab

sudo snap install rich-tab

Usage

something --format json | rtab -j
something --format yaml | rtab -y
something --format csv | rtab -c

Note

The snapstore install automatically adds the command alias rtab

You can get creative with this and use it to pretty print various existing tools

Note

This is meant to be an additive to existing awesome tools like jq, yq, etc...

  • Using with openstack cli
openstack server list -fjson | rtab -j
openstack server list -fcsv | rtab -c

For example:

  • without rtab without_rtab

  • with rtab with_rtab

Some more advanced usage

You can wrap this around openstack or kubectl for example by defining something like this in your bashrc,

function osr {
  openstack ${@?} --format json | rtab -j --wrap
}
export -f osr

And then run commands as osr server list, etc...

or around Kubernetes like so (still working on adding some more functionality into rtab to make this cleaner)

function kr {
  /snap/bin/kubectl ${@?} | sed 's/ ago/-ago/g' | sed 's/ (/-(/g' | tr ',' ';' | rtab -c -s " " -r kubernetes
}
export -f kr

Building and Dev

# unittests, linting etc...
make lint
make pre-commit unittests

# to build the snap
make build

# to install a local version of the snap
sudo snap install rich-tab.snap --dangerous

About

A simple formatting cli that converts json, yaml or csv into tables using the rich library

Resources

License

Stars

Watchers

Forks

Packages

No packages published