mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-02 04:15:46 +00:00
virsh: Add event name completion to 'network-event' command
Signed-off-by: Lin Ma <lma@suse.com>
This commit is contained in:
parent
96837ab140
commit
397369853d
@ -27,6 +27,7 @@
|
|||||||
#include "virsh-nodedev.h"
|
#include "virsh-nodedev.h"
|
||||||
#include "virsh-util.h"
|
#include "virsh-util.h"
|
||||||
#include "virsh-secret.h"
|
#include "virsh-secret.h"
|
||||||
|
#include "virsh-network.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "virutil.h"
|
#include "virutil.h"
|
||||||
#include "viralloc.h"
|
#include "viralloc.h"
|
||||||
@ -415,6 +416,32 @@ virshNetworkNameCompleter(vshControl *ctl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char **
|
||||||
|
virshNetworkEventNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
|
||||||
|
const vshCmd *cmd ATTRIBUTE_UNUSED,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
size_t i = 0;
|
||||||
|
char **ret = NULL;
|
||||||
|
|
||||||
|
virCheckFlags(0, NULL);
|
||||||
|
|
||||||
|
if (VIR_ALLOC_N(ret, VIR_NETWORK_EVENT_ID_LAST + 1) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
for (i = 0; i < VIR_NETWORK_EVENT_ID_LAST; i++) {
|
||||||
|
if (VIR_STRDUP(ret[i], virshNetworkEventCallbacks[i].name) < 0)
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
error:
|
||||||
|
virStringListFree(ret);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char **
|
char **
|
||||||
virshNodeDeviceNameCompleter(vshControl *ctl,
|
virshNodeDeviceNameCompleter(vshControl *ctl,
|
||||||
const vshCmd *cmd ATTRIBUTE_UNUSED,
|
const vshCmd *cmd ATTRIBUTE_UNUSED,
|
||||||
|
@ -55,6 +55,10 @@ char ** virshNetworkNameCompleter(vshControl *ctl,
|
|||||||
const vshCmd *cmd,
|
const vshCmd *cmd,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
char ** virshNetworkEventNameCompleter(vshControl *ctl,
|
||||||
|
const vshCmd *cmd,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
char ** virshNodeDeviceNameCompleter(vshControl *ctl,
|
char ** virshNodeDeviceNameCompleter(vshControl *ctl,
|
||||||
const vshCmd *cmd,
|
const vshCmd *cmd,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
@ -1216,6 +1216,7 @@ static const vshCmdOptDef opts_network_event[] = {
|
|||||||
VIRSH_COMMON_OPT_NETWORK_OT_STRING(N_("filter by network name or uuid"), 0),
|
VIRSH_COMMON_OPT_NETWORK_OT_STRING(N_("filter by network name or uuid"), 0),
|
||||||
{.name = "event",
|
{.name = "event",
|
||||||
.type = VSH_OT_STRING,
|
.type = VSH_OT_STRING,
|
||||||
|
.completer = virshNetworkEventNameCompleter,
|
||||||
.help = N_("which event type to wait for")
|
.help = N_("which event type to wait for")
|
||||||
},
|
},
|
||||||
{.name = "loop",
|
{.name = "loop",
|
||||||
|
Loading…
Reference in New Issue
Block a user