A simple formatting cli that converts json, yaml or csv into tables using the rich library.
sudo snap install rich-tab
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
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:
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
# 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