Open don-rumata opened 10 months ago
I'll take a look at this - it might not be too hard to do.
Playing around with this and I thought I had added a fix to preserve order even when resizing back in v1.4.0: https://github.com/kellyjonbrazil/jtbl/issues/7
This seems to be working for me - If I specify the order via jq
or similar then it keeps that order. Yet the example you have doesn't seem to be doing this:
% jc -a | jq '[.parsers[0:10][] | {name,version,details,description}]' | jtbl -m
| name | version | details | description |
|----------------|-----------|-------------------------|-------------------------------------------|
| acpi | 1.7 | | `acpi` command parser |
| airport | 1.5 | | `airport -I` command parser |
| airport_s | 1.6 | | `airport -s` command parser |
| apt_cache_show | 1.0 | Using the rpm-qi parser | `apt-cache show` command parser |
| apt_get_sqq | 1.0 | | `apt-get -sqq` command parser |
| arp | 1.12 | | `arp` command parser |
| asciitable | 1.2 | | ASCII and Unicode table parser |
| asciitable_m | 1.2 | | multi-line ASCII and Unicode table parser |
| blkid | 1.6 | | `blkid` command parser |
| bluetoothctl | 1.1 | | `bluetoothctl` command parser |
% jc -a | jq '[.parsers[0:10][] | {name,version,description,details}]' | jtbl -m
| name | version | description | details |
|----------------|-----------|-------------------------------------------|-------------------------|
| acpi | 1.7 | `acpi` command parser | |
| airport | 1.5 | `airport -I` command parser | |
| airport_s | 1.6 | `airport -s` command parser | |
| apt_cache_show | 1.0 | `apt-cache show` command parser | Using the rpm-qi parser |
| apt_get_sqq | 1.0 | `apt-get -sqq` command parser | |
| arp | 1.12 | `arp` command parser | |
| asciitable | 1.2 | ASCII and Unicode table parser | |
| asciitable_m | 1.2 | multi-line ASCII and Unicode table parser | |
| blkid | 1.6 | `blkid` command parser | |
| bluetoothctl | 1.1 | `bluetoothctl` command parser | |
I can still add an option for this, but it seems that this should work as a workaround. Is there something different about your example? (e.g. is jp
not keeping the order specified?)
The jp
is part of the jmespath.org project. It is used in Ansible. I use it because it's convenient. Adding the --order
option would probably help those who do NOT use jp
/jq
.
Hi. Can you add an option to sort columns in a table?
Now:
How i want: