Signed-off-by: Lin Ma <l...@suse.com>
---
 tools/virsh-completer-interface.c | 9 +++++++++
 tools/virsh-completer-interface.h | 4 ++++
 tools/virsh-interface.c           | 1 +
 3 files changed, 14 insertions(+)

diff --git a/tools/virsh-completer-interface.c 
b/tools/virsh-completer-interface.c
index 407021485f..dea8d645cd 100644
--- a/tools/virsh-completer-interface.c
+++ b/tools/virsh-completer-interface.c
@@ -69,3 +69,12 @@ 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);
+}
diff --git a/tools/virsh-completer-interface.h 
b/tools/virsh-completer-interface.h
index 32da01e766..b48ded6a12 100644
--- a/tools/virsh-completer-interface.h
+++ b/tools/virsh-completer-interface.h
@@ -28,3 +28,7 @@ typedef const char *
 char ** virshInterfaceNameCompleter(vshControl *ctl,
                                     const vshCmd *cmd,
                                     unsigned int flags);
+
+char ** virshInterfaceMacCompleter(vshControl *ctl,
+                                   const vshCmd *cmd,
+                                   unsigned int flags);
diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
index 8cdbc6e85f..ae2b52bfc3 100644
--- a/tools/virsh-interface.c
+++ b/tools/virsh-interface.c
@@ -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}
-- 
2.26.0


Reply via email to