mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-21 21:25:25 +00:00
virsh-completer: modify and fix bug in virshPoolTypeCompleter, now used for more commands
Signed-off-by: Adam Julis <ajulis@redhat.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
c8ca9d0118
commit
7cb4a68500
@ -93,13 +93,16 @@ 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);
|
||||
|
||||
if (!(flags & VIRSH_POOL_TYPE_COMPLETER_COMMA))
|
||||
return g_steal_pointer(&tmp);
|
||||
|
||||
if (vshCommandOptStringQuiet(ctl, cmd, "type", &type_str) < 0)
|
||||
return NULL;
|
||||
|
||||
return virshCommaStringListComplete(type_str, (const char **)tmp);
|
||||
}
|
||||
|
@ -32,6 +32,10 @@ virshPoolEventNameCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
||||
enum {
|
||||
VIRSH_POOL_TYPE_COMPLETER_COMMA = 1 << 0,
|
||||
};
|
||||
|
||||
char **
|
||||
virshPoolTypeCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
|
@ -1089,6 +1089,7 @@ static const vshCmdOptDef opts_pool_list[] = {
|
||||
{.name = "type",
|
||||
.type = VSH_OT_STRING,
|
||||
.completer = virshPoolTypeCompleter,
|
||||
.completer_flags = VIRSH_POOL_TYPE_COMPLETER_COMMA,
|
||||
.help = N_("only list pool of specified type(s) (if supported)")
|
||||
},
|
||||
{.name = "details",
|
||||
@ -1414,6 +1415,7 @@ static const vshCmdOptDef opts_find_storage_pool_sources_as[] = {
|
||||
{.name = "type",
|
||||
.type = VSH_OT_DATA,
|
||||
.flags = VSH_OFLAG_REQ,
|
||||
.completer = virshPoolTypeCompleter,
|
||||
.help = N_("type of storage pool sources to find")
|
||||
},
|
||||
{.name = "host",
|
||||
@ -1501,6 +1503,7 @@ static const vshCmdOptDef opts_find_storage_pool_sources[] = {
|
||||
{.name = "type",
|
||||
.type = VSH_OT_DATA,
|
||||
.flags = VSH_OFLAG_REQ,
|
||||
.completer = virshPoolTypeCompleter,
|
||||
.help = N_("type of storage pool sources to discover")
|
||||
},
|
||||
{.name = "srcSpec",
|
||||
|
Loading…
Reference in New Issue
Block a user