mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35: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;
|
g_auto(GStrv) tmp = NULL;
|
||||||
const char *type_str = NULL;
|
const char *type_str = NULL;
|
||||||
|
|
||||||
virCheckFlags(0, NULL);
|
virCheckFlags(VIRSH_POOL_TYPE_COMPLETER_COMMA, NULL);
|
||||||
|
|
||||||
if (vshCommandOptStringQuiet(ctl, cmd, "type", &type_str) < 0)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
tmp = virshEnumComplete(VIR_STORAGE_POOL_LAST,
|
tmp = virshEnumComplete(VIR_STORAGE_POOL_LAST,
|
||||||
virStoragePoolTypeToString);
|
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);
|
return virshCommaStringListComplete(type_str, (const char **)tmp);
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,10 @@ virshPoolEventNameCompleter(vshControl *ctl,
|
|||||||
const vshCmd *cmd,
|
const vshCmd *cmd,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
enum {
|
||||||
|
VIRSH_POOL_TYPE_COMPLETER_COMMA = 1 << 0,
|
||||||
|
};
|
||||||
|
|
||||||
char **
|
char **
|
||||||
virshPoolTypeCompleter(vshControl *ctl,
|
virshPoolTypeCompleter(vshControl *ctl,
|
||||||
const vshCmd *cmd,
|
const vshCmd *cmd,
|
||||||
|
@ -1089,6 +1089,7 @@ static const vshCmdOptDef opts_pool_list[] = {
|
|||||||
{.name = "type",
|
{.name = "type",
|
||||||
.type = VSH_OT_STRING,
|
.type = VSH_OT_STRING,
|
||||||
.completer = virshPoolTypeCompleter,
|
.completer = virshPoolTypeCompleter,
|
||||||
|
.completer_flags = VIRSH_POOL_TYPE_COMPLETER_COMMA,
|
||||||
.help = N_("only list pool of specified type(s) (if supported)")
|
.help = N_("only list pool of specified type(s) (if supported)")
|
||||||
},
|
},
|
||||||
{.name = "details",
|
{.name = "details",
|
||||||
@ -1414,6 +1415,7 @@ static const vshCmdOptDef opts_find_storage_pool_sources_as[] = {
|
|||||||
{.name = "type",
|
{.name = "type",
|
||||||
.type = VSH_OT_DATA,
|
.type = VSH_OT_DATA,
|
||||||
.flags = VSH_OFLAG_REQ,
|
.flags = VSH_OFLAG_REQ,
|
||||||
|
.completer = virshPoolTypeCompleter,
|
||||||
.help = N_("type of storage pool sources to find")
|
.help = N_("type of storage pool sources to find")
|
||||||
},
|
},
|
||||||
{.name = "host",
|
{.name = "host",
|
||||||
@ -1501,6 +1503,7 @@ static const vshCmdOptDef opts_find_storage_pool_sources[] = {
|
|||||||
{.name = "type",
|
{.name = "type",
|
||||||
.type = VSH_OT_DATA,
|
.type = VSH_OT_DATA,
|
||||||
.flags = VSH_OFLAG_REQ,
|
.flags = VSH_OFLAG_REQ,
|
||||||
|
.completer = virshPoolTypeCompleter,
|
||||||
.help = N_("type of storage pool sources to discover")
|
.help = N_("type of storage pool sources to discover")
|
||||||
},
|
},
|
||||||
{.name = "srcSpec",
|
{.name = "srcSpec",
|
||||||
|
Loading…
Reference in New Issue
Block a user