mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-20 11:35:19 +00:00
virsh: Add lifecycle type completion to set-lifecycle-action command
Signed-off-by: Lin Ma <lma@suse.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
96d01ce969
commit
bb331d90b8
@ -736,3 +736,24 @@ virshDomainSignalCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
|
|
||||||
return g_steal_pointer(&tmp);
|
return g_steal_pointer(&tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char **
|
||||||
|
virshDomainLifecycleCompleter(vshControl *ctl G_GNUC_UNUSED,
|
||||||
|
const vshCmd *cmd G_GNUC_UNUSED,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
VIR_AUTOSTRINGLIST tmp = NULL;
|
||||||
|
size_t i = 0;
|
||||||
|
|
||||||
|
virCheckFlags(0, NULL);
|
||||||
|
|
||||||
|
tmp = g_new0(char *, VIR_DOMAIN_LIFECYCLE_LAST + 1);
|
||||||
|
|
||||||
|
for (i = 0; i < VIR_DOMAIN_LIFECYCLE_LAST; i++) {
|
||||||
|
const char *name = virDomainLifecycleTypeToString(i);
|
||||||
|
tmp[i] = g_strdup(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_steal_pointer(&tmp);
|
||||||
|
}
|
||||||
|
@ -102,3 +102,7 @@ char ** virshDomainConsoleCompleter(vshControl *ctl,
|
|||||||
char ** virshDomainSignalCompleter(vshControl *ctl,
|
char ** virshDomainSignalCompleter(vshControl *ctl,
|
||||||
const vshCmd *cmd,
|
const vshCmd *cmd,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
char ** virshDomainLifecycleCompleter(vshControl *ctl,
|
||||||
|
const vshCmd *cmd,
|
||||||
|
unsigned int flags);
|
||||||
|
@ -5717,6 +5717,7 @@ static const vshCmdOptDef opts_setLifecycleAction[] = {
|
|||||||
{.name = "type",
|
{.name = "type",
|
||||||
.type = VSH_OT_DATA,
|
.type = VSH_OT_DATA,
|
||||||
.flags = VSH_OFLAG_REQ,
|
.flags = VSH_OFLAG_REQ,
|
||||||
|
.completer = virshDomainLifecycleCompleter,
|
||||||
.help = N_("lifecycle type to modify")
|
.help = N_("lifecycle type to modify")
|
||||||
},
|
},
|
||||||
{.name = "action",
|
{.name = "action",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user