On 2/14/24 09:35, Adam Julis wrote:
Signed-off-by: Adam Julis <ajulis(a)redhat.com>
---
tools/virsh-completer-pool.c | 11 +++++++++++
tools/virsh-completer-pool.h | 5 +++++
tools/virsh-pool.c | 2 ++
3 files changed, 18 insertions(+)
diff --git a/tools/virsh-completer-pool.c b/tools/virsh-completer-pool.c
index 0600394411..1081e5c10c 100644
--- a/tools/virsh-completer-pool.c
+++ b/tools/virsh-completer-pool.c
@@ -66,6 +66,17 @@ virshStoragePoolNameCompleter(vshControl *ctl,
}
+char **
+virshStoragePoolTypeCompleter(vshControl *ctl G_GNUC_UNUSED,
+ const vshCmd *cmd G_GNUC_UNUSED,
+ unsigned int flags)
+{
+ virCheckFlags(0, NULL);
+
+ return virshEnumComplete(VIR_STORAGE_POOL_LAST, virStoragePoolTypeToString);
+}
+
+
So below this function, we already have virshPoolTypeCompleter() which
does pretty much the same. I'm wondering whether we could introduce a
flag, say VIRSH_POOL_TYPE_COMPLETER_COMMA which would control whether
the completer should return retval of virshEnumComplete() directly or
retval of virshCommaStringListComplete().
This way we can even fix existing bug where virshPoolTypeCompleter() is
used to complete arguments which obviously do not accept comma separate
string list (git grep virshPoolTypeCompleter --> git grep
VIRSH_COMMON_OPT_POOL_X_AS --> opts_pool_define_as and
opts_pool_create_as).
Besides that, patch looks good and if it wasn't for pre-existing bug I'd
merge it.
Michal