[lxc-devel] [lxd/master] lxc/list: define list columns arguments via LXC_LIST_COLUMNS environment variable
TerraTech on Github
lxc-bot at linuxcontainers.org
Sun Sep 23 01:38:37 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 667 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180923/40b83244/attachment.bin>
-------------- next part --------------
From 622e1e8e0ef1be61950b806127bb941dca57a0ea Mon Sep 17 00:00:00 2001
From: fqbuild <TerraTech at users.noreply.github.com>
Date: Sat, 22 Sep 2018 20:21:50 -0400
Subject: [PATCH] lxc/list: define list columns arguments via LXC_LIST_COLUMNS
environment variable
$ LXC_LIST_COLUMNS=nsl lxc list
+-------------+---------+----------------------+
| NAME | STATE | LAST USED AT |
+-------------+---------+----------------------+
| gentoo-lc | RUNNING | 2018/09/20 21:10 UTC |
+-------------+---------+----------------------+
Signed-off-by: fqbuild <TerraTech at users.noreply.github.com>
---
lxc/list.go | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lxc/list.go b/lxc/list.go
index 4c73756d13..5c216a0622 100644
--- a/lxc/list.go
+++ b/lxc/list.go
@@ -71,7 +71,7 @@ which container attributes to output when displaying in table or csv
format.
Column arguments are either pre-defined shorthand chars (see below),
-or (extended) config keys.
+(extended) config keys, or by setting the LXC_LIST_COLUMNS environment variable.
Commas between consecutive shorthand chars are optional.
@@ -475,6 +475,11 @@ func (c *cmdList) parseColumns(clustered bool) ([]column, bool, error) {
c.flagColumns = "nsacPt"
}
+ envFlagColumns := os.Getenv("LXC_LIST_COLUMNS")
+ if envFlagColumns != "" {
+ c.flagColumns = envFlagColumns
+ }
+
if clustered {
columnsShorthandMap['L'] = column{
i18n.G("LOCATION"), c.locationColumnData, false, false}
More information about the lxc-devel
mailing list