I write a lot of markdown. Something I often end up wanting is markdown tables, especially when I am commenting on or creating pull requests on github.com.
Sadly the process of making markdown tables is oddly annoying. Especially if
you want to make the formatted nicely. There are tools that can do this for
you. pandoc being the big one. That said pandoc
is
a swiss army knife of tools. It can do just about everything and anything. I
wanted something a bit simpler.
So I wrote mktable.
$ echo "foo,bar,baz\nfoo1,bar1,baz1" | mktable -s ',' -no-header
| | | |
| ---- | ---- | ---- |
| foo | bar | baz |
| foo1 | bar1 | baz1 |
foo | bar | baz |
foo1 | bar1 | baz1 |
$ netstat -i | mktable -s '\s+'
| Name | Mtu | Network | Address | Ipkts | Ierrs | Opkts | Oerrs | Coll |
| ----- | ----- | ----------- | ----------------- | ------- | ------ | ------ | ----- | ---- |
| lo0 | 16384 | <Link#1> | 377217 | 0 | 377217 | 0 | 0 | |
| lo0 | 16384 | 127 | localhost | 377217 | - | 377217 | - | - |
Name | Mtu | Network | Address | Ipkts | Ierrs | Opkts | Oerrs | Coll |
---|---|---|---|---|---|---|---|---|
lo0 | 16384 | <Link#1> | 377217 | 0 | 377217 | 0 | 0 | |
lo0 | 16384 | 127 | localhost | 377217 | - | 377217 | - | - |