mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
Add lifecycle action 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
bb331d90b8
commit
d44a8203e7
@ -757,3 +757,24 @@ virshDomainLifecycleCompleter(vshControl *ctl G_GNUC_UNUSED,
|
||||
|
||||
return g_steal_pointer(&tmp);
|
||||
}
|
||||
|
||||
|
||||
char **
|
||||
virshDomainLifecycleActionCompleter(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_ACTION_LAST + 1);
|
||||
|
||||
for (i = 0; i < VIR_DOMAIN_LIFECYCLE_ACTION_LAST; i++) {
|
||||
const char *action = virDomainLifecycleActionTypeToString(i);
|
||||
tmp[i] = g_strdup(action);
|
||||
}
|
||||
|
||||
return g_steal_pointer(&tmp);
|
||||
}
|
||||
|
@ -106,3 +106,7 @@ char ** virshDomainSignalCompleter(vshControl *ctl,
|
||||
char ** virshDomainLifecycleCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
||||
char ** virshDomainLifecycleActionCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
@ -5723,6 +5723,7 @@ static const vshCmdOptDef opts_setLifecycleAction[] = {
|
||||
{.name = "action",
|
||||
.type = VSH_OT_DATA,
|
||||
.flags = VSH_OFLAG_REQ,
|
||||
.completer = virshDomainLifecycleActionCompleter,
|
||||
.help = N_("lifecycle action to set")
|
||||
},
|
||||
VIRSH_COMMON_OPT_DOMAIN_CONFIG,
|
||||
|
Loading…
Reference in New Issue
Block a user