[lxc-users] Clean output for lxc list
Mark Constable
markc at renta.net
Thu Mar 10 11:39:00 UTC 2016
On 10/03/16 18:54, Stéphane Graber wrote:
> We've had a few folks ask for a --format option of some sort which
> would allow them to get the info in csv, tabular or json/yaml
> format.
One simple approach could be that if one used the default lxc list
with anything other than -c (or --columns) then the current ascii
border eye-candy remains intact but as soon as -c is used then the
ascii border (and header) is removed and the vertical bars replaced
with tabs. The logic being that if someone uses -c then they know
what they are looking for and do not need the extra visual support.
ie;...
~ lxc list gc3
+------+---------+--------------------+------+------------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+------+---------+--------------------+------+------------+-----------+
| gc3 | RUNNING | 192.168.0.3 (eth0) | | PERSISTENT | 0 |
+------+---------+--------------------+------+------------+-----------+
~ lxc list gc3 -c ns46tS
gc3<tab>RUNNING<tab>192.168.0.3 (eth0)<tab><tab>PERSISTENT<tab>0
More information about the lxc-users
mailing list