[lxc-devel] [lxd/master] fix parsing for container name tab-completion

albertodonato on Github lxc-bot at linuxcontainers.org
Wed Jan 10 23:01:18 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 1029 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180110/dff0d12f/attachment.bin>
-------------- next part --------------
From f26a91cd20498036c502034d6487f32b3502f531 Mon Sep 17 00:00:00 2001
From: Alberto Donato <alberto.donato at gmail.com>
Date: Wed, 10 Jan 2018 23:47:48 +0100
Subject: [PATCH] fix parsing for container name tab-completion

---
 config/bash/lxd-client | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/config/bash/lxd-client b/config/bash/lxd-client
index e74dd8d95..fbbefbcd7 100644
--- a/config/bash/lxd-client
+++ b/config/bash/lxd-client
@@ -6,11 +6,11 @@ _have lxc && {
       local state=$1
       local keys=$2
 
-      local cmd="lxc list --fast"
-      [ -n "$state" ] && cmd="$cmd | grep -E '$state'"
+      local cmd="lxc list --format=csv --columns=ns"
+      [ -n "$state" ] && cmd="$cmd | grep -E '$state$'"
 
       COMPREPLY=( $( compgen -W \
-        "$( eval $cmd | grep -Ev '(\+--|NAME)' | awk '{print $2}' ) $keys" "$cur" )
+        "$( eval $cmd | cut -d, -f1 ) $keys" "$cur" )
       )
     }
 


More information about the lxc-devel mailing list