[lxc-devel] [lxd/master] lxc/image: define list column arguments via LXC_IMAGE_LIST_COLUMNS environment variable

TerraTech on Github lxc-bot at linuxcontainers.org
Sun Sep 23 05:43:00 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 635 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180923/3bf8d7fa/attachment.bin>
-------------- next part --------------
From 948f4ad4bf4e728268802a1bc207739184539e8d Mon Sep 17 00:00:00 2001
From: fqbuild <TerraTech at users.noreply.github.com>
Date: Sun, 23 Sep 2018 01:34:24 -0400
Subject: [PATCH] lxc/image: define list column arguments via
 LXC_IMAGE_LIST_COLUMNS environment variable

  $ LXC_IMAGE_LIST_COLUMNS=lf lxc image list alpine
  +---------------------+--------------+
  |        ALIAS        | FINGERPRINT  |
  +---------------------+--------------+
  | alpine/3.4 (3 more) | cc8b58012122 |
  +---------------------+--------------+

Signed-off-by: fqbuild <TerraTech at users.noreply.github.com>
---
 lxc/image.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lxc/image.go b/lxc/image.go
index 4d9272ffad..caa612be2e 100644
--- a/lxc/image.go
+++ b/lxc/image.go
@@ -907,7 +907,8 @@ or part of the image hash or part of the image alias name.
 
 The -c option takes a (optionally comma-separated) list of arguments
 that control which image attributes to output when displaying in table
-or csv format.
+or csv format.  The column arguments can also be set by the
+LXC_IMAGE_LIST_COLUMNS environment variable.
 
 Default column layout is: lfpdasu
 
@@ -940,6 +941,10 @@ func (c *cmdImageList) parseColumns() ([]imageColumn, error) {
 		'u': {i18n.G("UPLOAD DATE"), c.uploadDateColumnData},
 	}
 
+	if envFlagColumns := os.Getenv("LXC_IMAGE_LIST_COLUMNS"); envFlagColumns != "" {
+		c.flagColumns = envFlagColumns
+	}
+
 	columnList := strings.Split(c.flagColumns, ",")
 
 	columns := []imageColumn{}


More information about the lxc-devel mailing list