Re: [PATCH v2] virsh-completer: modify and fix bug in virshPoolTypeCompleter, now used for more commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/20/24 10:31, Adam Julis wrote:

Signed-off-by: Adam Julis <ajulis@xxxxxxxxxx>
---
v2:
- instead new completer is used already existing virshPoolTypeCompleter
- added flag VIRSH_POOL_TYPE_COMPLETER_COMMA for the completer
- fixed bug in pool-list --type command

v1:
https://lists.libvirt.org/archives/list/devel@xxxxxxxxxxxxxxxxx/message/K6GT4P5S52DSRYMVQD3HLGIN33N4XPJR/

  tools/virsh-completer-domain.h |  4 ++++
  tools/virsh-completer-pool.c   | 14 +++++++++-----
  tools/virsh-pool.c             |  3 +++
  3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/tools/virsh-completer-pool.c b/tools/virsh-completer-pool.c
index 0600394411..abad0fca1b 100644
--- a/tools/virsh-completer-pool.c
+++ b/tools/virsh-completer-pool.c
@@ -93,13 +93,17 @@ virshPoolTypeCompleter(vshControl *ctl,
      g_auto(GStrv) tmp = NULL;
      const char *type_str = NULL;
- virCheckFlags(0, NULL);
-
-    if (vshCommandOptStringQuiet(ctl, cmd, "type", &type_str) < 0)
-        return NULL;
+    virCheckFlags(VIRSH_POOL_TYPE_COMPLETER_COMMA, NULL);
tmp = virshEnumComplete(VIR_STORAGE_POOL_LAST,
                              virStoragePoolTypeToString);
- return virshCommaStringListComplete(type_str, (const char **)tmp);
+    if (flags & VIRSH_POOL_TYPE_COMPLETER_COMMA){
+        if (vshCommandOptStringQuiet(ctl, cmd, "type", &type_str) < 0)
+            return NULL;
+
+        return virshCommaStringListComplete(type_str, (const char **)tmp);
+    }
+
+    return g_steal_pointer(&tmp);
  }

Consider this squashed in

diff --git i/tools/virsh-completer-pool.c w/tools/virsh-completer-pool.c
index abad0fca1b..f3f10de943 100644
--- i/tools/virsh-completer-pool.c
+++ w/tools/virsh-completer-pool.c
@@ -98,7 +98,7 @@ virshPoolTypeCompleter(vshControl *ctl,
     tmp = virshEnumComplete(VIR_STORAGE_POOL_LAST,
                             virStoragePoolTypeToString);

-    if (flags & VIRSH_POOL_TYPE_COMPLETER_COMMA){
+    if (flags & VIRSH_POOL_TYPE_COMPLETER_COMMA) {
         if (vshCommandOptStringQuiet(ctl, cmd, "type", &type_str) < 0)
             return NULL;
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux