mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
virsh: Introduce net-update --section completer
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
687d6f1d7b
commit
d724ca8fcd
@ -241,3 +241,23 @@ virshNetworkUpdateCommandCompleter(vshControl *ctl G_GNUC_UNUSED,
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
char **
|
||||
virshNetworkUpdateSectionCompleter(vshControl *ctl G_GNUC_UNUSED,
|
||||
const vshCmd *cmd G_GNUC_UNUSED,
|
||||
unsigned int flags)
|
||||
{
|
||||
char **ret = NULL;
|
||||
size_t i;
|
||||
|
||||
virCheckFlags(0, NULL);
|
||||
|
||||
ret = g_new0(char *, VIR_NETWORK_SECTION_LAST);
|
||||
|
||||
/* The first item in the enum is not accepted by virsh. */
|
||||
for (i = 1; i < VIR_NETWORK_SECTION_LAST; i++)
|
||||
ret[i - 1] = g_strdup(virshNetworkSectionTypeToString(i));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -51,3 +51,8 @@ char **
|
||||
virshNetworkUpdateCommandCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
||||
char **
|
||||
virshNetworkUpdateSectionCompleter(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int flags);
|
||||
|
@ -925,6 +925,7 @@ static const vshCmdOptDef opts_network_update[] = {
|
||||
{.name = "section",
|
||||
.type = VSH_OT_DATA,
|
||||
.flags = VSH_OFLAG_REQ,
|
||||
.completer = virshNetworkUpdateSectionCompleter,
|
||||
.help = N_("which section of network configuration to update")
|
||||
},
|
||||
{.name = "xml",
|
||||
@ -948,7 +949,6 @@ VIR_ENUM_IMPL(virshNetworkUpdateCommand,
|
||||
VIR_NETWORK_UPDATE_COMMAND_LAST,
|
||||
"none", "modify", "delete", "add-last", "add-first");
|
||||
|
||||
VIR_ENUM_DECL(virshNetworkSection);
|
||||
VIR_ENUM_IMPL(virshNetworkSection,
|
||||
VIR_NETWORK_SECTION_LAST,
|
||||
"none", "bridge", "domain", "ip", "ip-dhcp-host",
|
||||
|
@ -45,5 +45,6 @@ typedef struct virshNetworkEventCallback virshNetworkEventCallback;
|
||||
extern virshNetworkEventCallback virshNetworkEventCallbacks[];
|
||||
|
||||
VIR_ENUM_DECL(virshNetworkUpdateCommand);
|
||||
VIR_ENUM_DECL(virshNetworkSection);
|
||||
|
||||
extern const vshCmdDef networkCmds[];
|
||||
|
Loading…
Reference in New Issue
Block a user