mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
virsh: Add signal name completion to send-process-signal 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
7a975279b1
commit
96d01ce969
@ -715,3 +715,24 @@ virshDomainConsoleCompleter(vshControl *ctl,
|
||||
|
||||
return g_steal_pointer(&tmp);
|
||||
}
|
||||
|
||||
|
||||
char **
|
||||
virshDomainSignalCompleter(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_PROCESS_SIGNAL_LAST + 1);
|
||||
|
||||
for (i = 0; i < VIR_DOMAIN_PROCESS_SIGNAL_LAST; i++) {
|
||||
const char *name = virDomainProcessSignalTypeToString(i);
|
||||
tmp[i] = g_strdup(name);
|
||||
}
|
||||
|
||||
return g_steal_pointer(&tmp);
|
||||
}
|
||||
|
@ -98,3 +98,7 @@ char ** virshDomainVcpulistViaAgentCompleter(vshControl *ctl,
|
||||
char ** virshDomainConsoleCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
||||
char ** virshDomainSignalCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
@ -8905,6 +8905,7 @@ static const vshCmdOptDef opts_send_process_signal[] = {
|
||||
{.name = "signame",
|
||||
.type = VSH_OT_DATA,
|
||||
.flags = VSH_OFLAG_REQ,
|
||||
.completer = virshDomainSignalCompleter,
|
||||
.help = N_("the signal number or name")
|
||||
},
|
||||
{.name = NULL}
|
||||
|
Loading…
Reference in New Issue
Block a user