Currently, the lxc list output is not so easy to parse, it contains all of these tabulating characters:
$ lxc list wily:
+--------------------------+---------+-----------+------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | EPHEMERAL | SNAPSHOTS |
+--------------------------+---------+-----------+------+-----------+-----------+
| antihierarchical-tabatha | RUNNING | 10.3.0.60 | | NO | 0 |
+--------------------------+---------+-----------+------+-----------+-----------+
Compare with docker ps which is trivial to parse with awk:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2a4017e2f038 nginx:latest "nginx -g 'daemon of 52 minutes ago Up 52 minutes 80/tcp, 443/tcp origin2
c8b134d22dd9 nginx:latest "nginx -g 'daemon of 53 minutes ago Up 52 minutes 80/tcp, 443/tcp origin1
We could introduce a --format option or similar to alter the rendering to be something easier to parse.
+1 to this feature implementation. --format will be a useful feature..
:+1: I really would like this feature
Also .. just IMHO ... as this is server console app default output should be as simple to parse. All fancy formatting should require manually specifying switch ex. "-f --fancy" ?
doing ...
# lxc list -cns|grep RUNNING|awk '{print $2}'
... just to get list of running ct's is ... aquard
(I really like lxd thou :)
Having user friendly formatting by default I think is important but we'd certainly be happy to have alternative easier to parse formatting available.
+1
--format json would be incredibly useful.
Most helpful comment
We could introduce a --format option or similar to alter the rendering to be something easier to parse.