The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6934

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Closes #6910 
-Add project list function
-Add project key list
-Add tab complete for "create delete edit get list rename set show switch unset " functions
-Add project list after above functions
-Add project key list after "get"|"set"|"unset" functions
-Add additional project list for "rename" function

Question: How would I test this functionality on my local computer? I tried to make a copy of /snap/lxd/current/etc/bash_completion.d/snap.lxd.lxc on my local server then replace it with my edited version, but the file is in use. I'm guessing that's due to lxd running, how would one hot swap the file?
From 51ce584ca1422064bfccd726c789fd758b36002a Mon Sep 17 00:00:00 2001
From: Brian Neumeyer <bpneu...@oakland.edu>
Date: Tue, 25 Feb 2020 14:38:26 -0500
Subject: [PATCH] Update Project Tab Complete Script

-Add project list function
-Add project key list
-Add tab complete for "create delete edit get list rename set show switch unset 
" functions
-Add project list after above functions
-Add project key list after "get"|"set"|"unset" functions
-Add additional project list for "rename" function

Question: How would I test this functionality on my local computer? I tried to 
make a copy of /snap/lxd/current/etc/bash_completion.d/snap.lxd.lxc on my local 
server then replace it with my edited version, but the file is in use. I'm 
guessing that's due to lxd running, how would one hot swap the file?
---
 scripts/bash/lxd-client | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/scripts/bash/lxd-client b/scripts/bash/lxd-client
index 65de585d16..f12ec1b553 100644
--- a/scripts/bash/lxd-client
+++ b/scripts/bash/lxd-client
@@ -32,6 +32,11 @@ _have lxc && {
     {
       COMPREPLY=( $( compgen -W "$( lxc profile list | tail -n +4 | awk 
'{print $2}' | egrep -v '^(\||^$)' )" "$cur" ) )
     }
+       
+    _lxd_projects()
+    {
+      COMPREPLY=( $( compgen -W "$( lxc project list | tail -n +4 | awk 
'{print $2}' | egrep -v '^(\||^$)' )" "$cur" ) )
+    }  
 
     _lxd_networks()
     {
@@ -124,6 +129,8 @@ _have lxc && {
       ipv4.routes ipv4.routing ipv6.address ipv6.dhcp ipv6.dhcp.expiry 
ipv6.dhcp.ranges \
       ipv6.dhcp.stateful ipv6.firewall ipv6.nat ipv6.nat.address 
ipv6.nat.order \
       ipv6.routes ipv6.routing raw.dnsmasq"
+         
+       project_keys="features.images features.profiles"
 
     storage_pool_keys="source size btrfs.mount_options ceph.cluster_name \
       ceph.osd.force_reuse ceph.osd.pg_num ceph.osd.pool_name 
ceph.osd.data_pool_name \
@@ -304,6 +311,33 @@ _have lxc && {
             ;;
         esac
         ;;
+      "project")
+        case $pos in
+          2)
+            COMPREPLY=( $(compgen -W "create delete edit get list rename set 
show switch unset " -- $cur) )
+            ;;
+                       
+          3)
+            case ${no_dashargs[2]} in
+              
"get"|"set"|"unset"|"create"|"delete"|"edit"|"list"|"show"|"switch"|"rename")
+                _lxd_projects
+                ;;
+            esac
+            ;;
+          4)
+            case ${no_dashargs[2]} in
+              "get"|"set"|"unset")
+                               COMPREPLY=( $(compgen -W "$project_keys" -- 
$cur) )
+                               ;;
+                               esac
+                 5)
+                       case ${no_dashargs[2]} in
+              "rename")
+                               _lxd_projects
+                               ;;
+                               esac
+        esac
+        ;;
       "publish")
         _lxd_names
         ;;
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to