]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Add interface mac completion to iface-name command
authorLin Ma <lma@suse.com>
Tue, 10 Nov 2020 09:50:56 +0000 (17:50 +0800)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 10 Nov 2020 17:34:11 +0000 (18:34 +0100)
Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tools/virsh-completer-interface.c
tools/virsh-completer-interface.h
tools/virsh-interface.c

index 1aea7e03c5329257b62facd76aa557eec0fa0d50..1eea2d462a6d8da2c457dd051547cdab7644f6d4 100644 (file)
@@ -73,3 +73,13 @@ virshInterfaceNameCompleter(vshControl *ctl,
 {
     return virshInterfaceStringHelper(ctl, cmd, flags, virInterfaceGetName);
 }
+
+
+char **
+virshInterfaceMacCompleter(vshControl *ctl,
+                           const vshCmd *cmd,
+                           unsigned int flags)
+{
+    return virshInterfaceStringHelper(ctl, cmd, flags,
+                                      virInterfaceGetMACString);
+}
index 893dee5a6b3c100965e18d179cc4bda4b96a075e..733f18cb88c226feb49da6ba638234ec354aa97d 100644 (file)
@@ -25,3 +25,7 @@
 char ** virshInterfaceNameCompleter(vshControl *ctl,
                                     const vshCmd *cmd,
                                     unsigned int flags);
+
+char ** virshInterfaceMacCompleter(vshControl *ctl,
+                                   const vshCmd *cmd,
+                                   unsigned int flags);
index 8cdbc6e85f11bf75c9ae7e789fb96220deee77d7..ae2b52bfc3478aff906cf82e11a0439599e9ae00 100644 (file)
@@ -404,6 +404,7 @@ static const vshCmdOptDef opts_interface_name[] = {
     {.name = "interface",
      .type = VSH_OT_DATA,
      .flags = VSH_OFLAG_REQ,
+     .completer = virshInterfaceMacCompleter,
      .help = N_("interface mac")
     },
     {.name = NULL}