]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: completer: Extract common completer methods from virsh to vsh
authorPeter Krempa <pkrempa@redhat.com>
Tue, 20 May 2025 13:21:22 +0000 (15:21 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 21 May 2025 13:49:36 +0000 (15:49 +0200)
The helper methods as well as the empty completers can be useful also in
other virt shells; extract the code and rename the functions
appropriately.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
23 files changed:
tools/meson.build
tools/virsh-backup.c
tools/virsh-checkpoint.c
tools/virsh-completer-domain.c
tools/virsh-completer-host.c
tools/virsh-completer-nodedev.c
tools/virsh-completer-pool.c
tools/virsh-completer-volume.c
tools/virsh-completer.h
tools/virsh-domain.c
tools/virsh-host.c
tools/virsh-interface.c
tools/virsh-network.c
tools/virsh-nodedev.c
tools/virsh-nwfilter.c
tools/virsh-pool.c
tools/virsh-secret.c
tools/virsh-snapshot.c
tools/virsh-volume.c
tools/virsh.c
tools/virsh.h
tools/vsh-completer.c [moved from tools/virsh-completer.c with 85% similarity]
tools/vsh-completer.h [new file with mode: 0644]

index 4d5c9e4bbacc459390c01c3c9fe20c1a9ce157dc..a099148d3c347aeffbadeb6b0524d5b1e78931be 100644 (file)
@@ -25,6 +25,7 @@ libvirt_shell_lib = static_library(
   [
     'vsh.c',
     'vsh-table.c',
+    'vsh-completer.c',
   ],
   dependencies: [
     tools_dep,
@@ -169,7 +170,6 @@ virsh_prog = executable(
     'virsh.c',
     'virsh-backup.c',
     'virsh-checkpoint.c',
-    'virsh-completer.c',
     'virsh-completer-domain.c',
     'virsh-completer-checkpoint.c',
     'virsh-completer-host.c',
index 27777eea744def9ed69587cd27a2b45e20a1e273..39e62f9ba91c100bf6da2bbdb06218f9ff6670fa 100644 (file)
@@ -35,13 +35,13 @@ static const vshCmdOptDef opts_backup_begin[] = {
     {.name = "backupxml",
      .type = VSH_OT_STRING,
      .positional = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("domain backup XML"),
     },
     {.name = "checkpointxml",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("domain checkpoint XML"),
     },
     {.name = "reuse-external",
@@ -109,7 +109,7 @@ static const vshCmdOptDef opts_backup_dumpxml[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
index a0ac0d7f7116e529a3d58bccb19a752cd89e7ea9..1a168a1c389b0f5d0560338f72ba103746fdb84a 100644 (file)
@@ -82,7 +82,7 @@ static const vshCmdOptDef opts_checkpoint_create[] = {
     {.name = "xmlfile",
      .type = VSH_OT_STRING,
      .positional = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("domain checkpoint XML")
     },
     {.name = "redefine",
@@ -190,13 +190,13 @@ static const vshCmdOptDef opts_checkpoint_create_as[] = {
     {.name = "name",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("name of checkpoint")
     },
     {.name = "description",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("description of checkpoint")
     },
     {.name = "print-xml",
@@ -837,7 +837,7 @@ static const vshCmdOptDef opts_checkpoint_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
index 3a165bc4a55e71e5bce47252fb6de21964e1e5cb..912826c434a12f99070c711a28f62afc31ba5d9c 100644 (file)
@@ -235,7 +235,7 @@ virshDomainDiskTargetListCompleter(vshControl *ctl,
     if (!targets)
         return NULL;
 
-    return virshCommaStringListComplete(curval, (const char **) targets);
+    return vshCommaStringListComplete(curval, (const char **) targets);
 }
 
 
@@ -307,7 +307,7 @@ virshDomainThrottleGroupsCompleter(vshControl *ctl,
     if (!groups)
         return NULL;
 
-    return virshCommaStringListComplete(curval, (const char **) groups);
+    return vshCommaStringListComplete(curval, (const char **) groups);
 }
 
 
@@ -529,7 +529,7 @@ virshDomainShutdownModeCompleter(vshControl *ctl,
     if (vshCommandOptStringQuiet(ctl, cmd, "mode", &mode) < 0)
         return NULL;
 
-    return virshCommaStringListComplete(mode, modes);
+    return vshCommaStringListComplete(mode, modes);
 }
 
 
@@ -540,8 +540,8 @@ virshDomainInterfaceAddrSourceCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LAST,
-                             virshDomainInterfaceAddressesSourceTypeToString);
+    return vshEnumComplete(VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LAST,
+                           virshDomainInterfaceAddressesSourceTypeToString);
 }
 
 
@@ -552,8 +552,8 @@ virshDomainInterfaceSourceModeCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIRSH_DOMAIN_INTERFACE_SOURCE_MODE_LAST,
-                             virshDomainInterfaceSourceModeTypeToString);
+    return vshEnumComplete(VIRSH_DOMAIN_INTERFACE_SOURCE_MODE_LAST,
+                           virshDomainInterfaceSourceModeTypeToString);
 }
 
 
@@ -564,8 +564,8 @@ virshDomainHostnameSourceCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIRSH_DOMAIN_HOSTNAME_SOURCE_LAST,
-                             virshDomainHostnameSourceTypeToString);
+    return vshEnumComplete(VIRSH_DOMAIN_HOSTNAME_SOURCE_LAST,
+                           virshDomainHostnameSourceTypeToString);
 }
 
 
@@ -582,10 +582,10 @@ virshDomainPerfEnableCompleter(vshControl *ctl,
     if (vshCommandOptStringQuiet(ctl, cmd, "enable", &event) < 0)
         return NULL;
 
-    events = virshEnumComplete(VIR_PERF_EVENT_LAST,
-                               virPerfEventTypeToString);
+    events = vshEnumComplete(VIR_PERF_EVENT_LAST,
+                             virPerfEventTypeToString);
 
-    return virshCommaStringListComplete(event, (const char **)events);
+    return vshCommaStringListComplete(event, (const char **)events);
 }
 
 
@@ -602,10 +602,10 @@ virshDomainPerfDisableCompleter(vshControl *ctl,
     if (vshCommandOptStringQuiet(ctl, cmd, "disable", &event) < 0)
         return NULL;
 
-    events = virshEnumComplete(VIR_PERF_EVENT_LAST,
-                               virPerfEventTypeToString);
+    events = vshEnumComplete(VIR_PERF_EVENT_LAST,
+                             virPerfEventTypeToString);
 
-    return virshCommaStringListComplete(event, (const char **)events);
+    return vshCommaStringListComplete(event, (const char **)events);
 }
 
 
@@ -708,7 +708,7 @@ virshDomainVcpulistCompleter(vshControl *ctl,
     for (id = 0; id < nvcpus; id++)
         vcpulist[id] = g_strdup_printf("%u", id);
 
-    return virshCommaStringListComplete(vcpuid, (const char **)vcpulist);
+    return vshCommaStringListComplete(vcpuid, (const char **)vcpulist);
 }
 
 
@@ -738,7 +738,7 @@ virshDomainCpulistCompleter(vshControl *ctl,
     for (i = 0; i < cpunum; i++)
         cpulist[i] = g_strdup_printf("%zu", i);
 
-    return virshCommaStringListComplete(cpuid, (const char **)cpulist);
+    return vshCommaStringListComplete(cpuid, (const char **)cpulist);
 }
 
 
@@ -837,7 +837,7 @@ virshDomainVcpulistViaAgentCompleter(vshControl *ctl,
         }
     }
 
-    ret = virshCommaStringListComplete(vcpuid, (const char **)cpulist);
+    ret = vshCommaStringListComplete(vcpuid, (const char **)cpulist);
 
  cleanup:
     virTypedParamsFree(params, nparams);
@@ -906,8 +906,8 @@ virshDomainSignalCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIR_DOMAIN_PROCESS_SIGNAL_LAST,
-                             virshDomainProcessSignalTypeToString);
+    return vshEnumComplete(VIR_DOMAIN_PROCESS_SIGNAL_LAST,
+                           virshDomainProcessSignalTypeToString);
 }
 
 
@@ -918,8 +918,8 @@ virshDomainLifecycleCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIR_DOMAIN_LIFECYCLE_LAST,
-                             virshDomainLifecycleTypeToString);
+    return vshEnumComplete(VIR_DOMAIN_LIFECYCLE_LAST,
+                           virshDomainLifecycleTypeToString);
 }
 
 
@@ -930,8 +930,8 @@ virshDomainLifecycleActionCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIR_DOMAIN_LIFECYCLE_ACTION_LAST,
-                             virshDomainLifecycleActionTypeToString);
+    return vshEnumComplete(VIR_DOMAIN_LIFECYCLE_ACTION_LAST,
+                           virshDomainLifecycleActionTypeToString);
 }
 
 
@@ -942,8 +942,8 @@ virshCodesetNameCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIR_KEYCODE_SET_LAST,
-                             virKeycodeSetTypeToString);
+    return vshEnumComplete(VIR_KEYCODE_SET_LAST,
+                           virKeycodeSetTypeToString);
 }
 
 
@@ -1063,8 +1063,8 @@ virshDomainCoreDumpFormatCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIR_DOMAIN_CORE_DUMP_FORMAT_LAST,
-                             virshDomainCoreDumpFormatTypeToString);
+    return vshEnumComplete(VIR_DOMAIN_CORE_DUMP_FORMAT_LAST,
+                           virshDomainCoreDumpFormatTypeToString);
 }
 
 
@@ -1081,7 +1081,7 @@ virshDomainMigrateCompMethodsCompleter(vshControl *ctl,
     if (vshCommandOptStringQuiet(ctl, cmd, "comp-methods", &method) < 0)
         return NULL;
 
-    return virshCommaStringListComplete(method, methods);
+    return vshCommaStringListComplete(method, methods);
 }
 
 
@@ -1092,8 +1092,8 @@ virshDomainStorageFileFormatCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIR_STORAGE_FILE_LAST,
-                             virStorageFileFormatTypeToString);
+    return vshEnumComplete(VIR_STORAGE_FILE_LAST,
+                           virStorageFileFormatTypeToString);
 }
 
 
@@ -1104,8 +1104,8 @@ virshDomainNumatuneModeCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIR_DOMAIN_NUMATUNE_MEM_LAST,
-                             virDomainNumatuneMemModeTypeToString);
+    return vshEnumComplete(VIR_DOMAIN_NUMATUNE_MEM_LAST,
+                           virDomainNumatuneMemModeTypeToString);
 }
 
 
@@ -1116,6 +1116,6 @@ virshDomainDirtyRateCalcModeCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIRSH_DOMAIN_DIRTYRATE_CALC_MODE_LAST,
-                             virshDomainDirtyRateCalcModeTypeToString);
+    return vshEnumComplete(VIRSH_DOMAIN_DIRTYRATE_CALC_MODE_LAST,
+                           virshDomainDirtyRateCalcModeTypeToString);
 }
index 78d2236f97905b738a43b21ca2e3ff1f87f44e8c..c3919a6d91749c02795d36d8ddc17f3bafb21e79 100644 (file)
@@ -178,8 +178,8 @@ virshNodeSuspendTargetCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIR_NODE_SUSPEND_TARGET_LAST,
-                             virshNodeSuspendTargetTypeToString);
+    return vshEnumComplete(VIR_NODE_SUSPEND_TARGET_LAST,
+                           virshNodeSuspendTargetTypeToString);
 }
 
 
@@ -190,8 +190,8 @@ virshDomainVirtTypeCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIR_DOMAIN_VIRT_LAST,
-                             virDomainVirtTypeToString);
+    return vshEnumComplete(VIR_DOMAIN_VIRT_LAST,
+                           virDomainVirtTypeToString);
 }
 
 
@@ -202,8 +202,8 @@ virshArchCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIR_ARCH_LAST,
-                             (const char *(*)(int))virArchToString);
+    return vshEnumComplete(VIR_ARCH_LAST,
+                           (const char *(*)(int))virArchToString);
 }
 
 
index 72951a54f67eadd11ac161d9e95fe254e30b988f..289f803904d76345e28afa203c987ae2299fa3d7 100644 (file)
@@ -96,10 +96,10 @@ virshNodeDeviceCapabilityNameCompleter(vshControl *ctl,
     if (vshCommandOptStringQuiet(ctl, cmd, "cap", &cap_str) < 0)
         return NULL;
 
-    tmp = virshEnumComplete(VIR_NODE_DEV_CAP_LAST,
-                            virNodeDevCapTypeToString);
+    tmp = vshEnumComplete(VIR_NODE_DEV_CAP_LAST,
+                          virNodeDevCapTypeToString);
 
-    return virshCommaStringListComplete(cap_str, (const char **)tmp);
+    return vshCommaStringListComplete(cap_str, (const char **)tmp);
 }
 
 
@@ -110,6 +110,6 @@ virshNodeDevicePCIBackendCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST,
-                             virDeviceHostdevPCIDriverNameTypeToString);
+    return vshEnumComplete(VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST,
+                           virDeviceHostdevPCIDriverNameTypeToString);
 }
index 3568bb985b31d16ede02146b2592fb1b85a59178..6701436c0f6e58d1549e59613aa98426e04b768a 100644 (file)
@@ -95,8 +95,8 @@ virshPoolTypeCompleter(vshControl *ctl,
 
     virCheckFlags(VIRSH_POOL_TYPE_COMPLETER_COMMA, NULL);
 
-    tmp = virshEnumComplete(VIR_STORAGE_POOL_LAST,
-                            virStoragePoolTypeToString);
+    tmp = vshEnumComplete(VIR_STORAGE_POOL_LAST,
+                          virStoragePoolTypeToString);
 
     if (!(flags & VIRSH_POOL_TYPE_COMPLETER_COMMA))
         return g_steal_pointer(&tmp);
@@ -104,5 +104,5 @@ virshPoolTypeCompleter(vshControl *ctl,
     if (vshCommandOptStringQuiet(ctl, cmd, "type", &type_str) < 0)
         return NULL;
 
-    return virshCommaStringListComplete(type_str, (const char **)tmp);
+    return vshCommaStringListComplete(type_str, (const char **)tmp);
 }
index 9a80112e594cc81a5173de410affdbadbb0d66a9..5ad2e283186b4260d6a68444a74f84a038f6f1c8 100644 (file)
@@ -123,6 +123,6 @@ virshStorageVolWipeAlgorithmCompleter(vshControl *ctl G_GNUC_UNUSED,
 {
     virCheckFlags(0, NULL);
 
-    return virshEnumComplete(VIR_STORAGE_VOL_WIPE_ALG_LAST,
-                             virshStorageVolWipeAlgorithmTypeToString);
+    return vshEnumComplete(VIR_STORAGE_VOL_WIPE_ALG_LAST,
+                           virshStorageVolWipeAlgorithmTypeToString);
 }
index 131678dfbce158169f1da7da8d6c6262a7d28a16..2ddd5446cd0e475ec7a5106b60266b5dea05562c 100644 (file)
@@ -20,6 +20,7 @@
 
 #pragma once
 
+#include "vsh-completer.h"
 #include "virsh-completer-checkpoint.h"
 #include "virsh-completer-domain.h"
 #include "virsh-completer-host.h"
 #include "virsh-completer-secret.h"
 #include "virsh-completer-snapshot.h"
 #include "virsh-completer-volume.h"
-
-char **
-virshEnumComplete(unsigned int last,
-                  const char *(*intToStr)(int));
-
-char **
-virshCommaStringListComplete(const char *input,
-                             const char **options);
-
-char **
-virshCompletePathLocalExisting(vshControl *ctl,
-                               const vshCmd *cmd,
-                               unsigned int completerflags);
-
-char **
-virshCompleteEmpty(vshControl *ctl,
-                   const vshCmd *cmd,
-                   unsigned int completerflags);
index a5f87243a2f0884941b049c1dab702d80fd675c4..7e5e83126e468d20209332a29e4c17212409c25e 100644 (file)
@@ -429,7 +429,7 @@ static const vshCmdOptDef opts_attach_disk[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("target of disk device")
     },
     {.name = "targetbus",
@@ -475,17 +475,17 @@ static const vshCmdOptDef opts_attach_disk[] = {
     },
     {.name = "serial",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("serial of disk device")
     },
     {.name = "wwn",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("wwn of disk device")
     },
     {.name = "alias",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("custom alias name of disk device")
     },
     {.name = "rawio",
@@ -494,7 +494,7 @@ static const vshCmdOptDef opts_attach_disk[] = {
     },
     {.name = "address",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("address of disk device")
     },
     {.name = "multifunction",
@@ -511,7 +511,7 @@ static const vshCmdOptDef opts_attach_disk[] = {
     },
     {.name = "source-host-name",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("host name for source of disk device")
     },
     {.name = "source-host-transport",
@@ -847,13 +847,13 @@ static const vshCmdOptDef opts_attach_interface[] = {
     {.name = "target",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("target network name")
     },
     {.name = "mac",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("MAC address")
     },
     {.name = "script",
@@ -869,19 +869,19 @@ static const vshCmdOptDef opts_attach_interface[] = {
     {.name = "alias",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("custom alias name of interface device")
     },
     {.name = "inbound",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("control domain's incoming traffics")
     },
     {.name = "outbound",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("control domain's outgoing traffics")
     },
     VIRSH_COMMON_OPT_DOMAIN_PERSISTENT,
@@ -1405,7 +1405,7 @@ static const vshCmdOptDef opts_blkdeviotune[] = {
     },
     {.name = "group-name",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("group name to share I/O quota between multiple drives")
     },
     VSH_OPTS_IOTUNE,
@@ -1912,31 +1912,31 @@ static const vshCmdOptDef opts_blkiotune[] = {
     {.name = "device-weights",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("per-device IO Weights, in the form of /path/to/device,weight,...")
     },
     {.name = "device-read-iops-sec",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("per-device read I/O limit per second, in the form of /path/to/device,read_iops_sec,...")
     },
     {.name = "device-write-iops-sec",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("per-device write I/O limit per second, in the form of /path/to/device,write_iops_sec,...")
     },
     {.name = "device-read-bytes-sec",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("per-device bytes read per second, in the form of /path/to/device,read_bytes_sec,...")
     },
     {.name = "device-write-bytes-sec",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("per-device bytes wrote per second, in the form of /path/to/device,write_bytes_sec,...")
     },
     VIRSH_COMMON_OPT_DOMAIN_CONFIG,
@@ -2669,7 +2669,7 @@ static const vshCmdOptDef opts_blockcopy[] = {
     {.name = "xml",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("filename containing XML description of the copy destination")
     },
     {.name = "format",
@@ -3617,13 +3617,13 @@ static const vshCmdOptDef opts_domiftune[] = {
     {.name = "inbound",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("control domain's incoming traffics")
     },
     {.name = "outbound",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("control domain's outgoing traffics")
     },
     VIRSH_COMMON_OPT_DOMAIN_CONFIG,
@@ -4386,7 +4386,7 @@ static const vshCmdOptDef opts_start[] = {
     {.name = "pass-fds",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("pass file descriptors N,M,... to the guest")
     },
     {.name = "reset-nvram",
@@ -4541,7 +4541,7 @@ static const vshCmdOptDef opts_save[] = {
     {.name = "xml",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("filename containing updated XML for the target")
     },
     {.name = "running",
@@ -4939,7 +4939,7 @@ static const vshCmdOptDef opts_save_image_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
@@ -4994,7 +4994,7 @@ static const vshCmdOptDef opts_save_image_define[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("filename containing updated XML for the target")
     },
     {.name = "running",
@@ -5344,7 +5344,7 @@ static const vshCmdOptDef opts_managed_save_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
@@ -5392,7 +5392,7 @@ static const vshCmdOptDef opts_managed_save_define[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("filename containing updated XML for the target")
     },
     {.name = "running",
@@ -5680,7 +5680,7 @@ static const vshCmdOptDef opts_restore[] = {
     {.name = "xml",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("filename containing updated XML for the target")
     },
     {.name = "running",
@@ -5949,7 +5949,7 @@ static const vshCmdOptDef opts_screenshot[] = {
     {.name = "file",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("where to store the screenshot")
     },
     {.name = "screen",
@@ -6181,7 +6181,7 @@ static const vshCmdOptDef opts_set_user_password[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("the new password")
     },
     {.name = "encrypted",
@@ -8476,7 +8476,7 @@ static const vshCmdOptDef opts_create[] = {
     {.name = "pass-fds",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("pass file descriptors N,M,... to the guest")
     },
     {.name = "validate",
@@ -8833,7 +8833,7 @@ static const vshCmdOptDef opts_metadata[] = {
     {.name = "set",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("new metadata to set"),
     },
     {.name = "remove",
@@ -9086,7 +9086,7 @@ static const vshCmdOptDef opts_send_process_signal[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("the process ID")
     },
     {.name = "signame",
@@ -10036,14 +10036,14 @@ static const vshCmdOptDef opts_dom_fd_associate[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("name of the FD group")
     },
     {.name = "pass-fds",
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("file descriptors N,M,... to associate")
     },
     {.name = "seclabel-writable",
@@ -10112,7 +10112,7 @@ static const vshCmdOptDef opts_qemu_monitor_command[] = {
     },
     {.name = "pass-fds",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("pass file descriptors N,M,... along with the command")
     },
     {.name = "cmd",
@@ -10446,7 +10446,7 @@ static const vshCmdOptDef opts_qemu_attach[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("pid")
     },
     {.name = NULL}
@@ -10705,7 +10705,7 @@ static const vshCmdOptDef opts_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
@@ -10768,7 +10768,7 @@ static const vshCmdOptDef opts_domxmlfromnative[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("config data file to import from")
     },
     {.name = NULL}
@@ -10822,7 +10822,7 @@ static const vshCmdOptDef opts_domxmltonative[] = {
     {.name = "xml",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("xml data file to export from")
     },
     {.name = NULL}
@@ -10919,7 +10919,7 @@ static const vshCmdOptDef opts_domrename[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("new domain name")
     },
     {.name = NULL}
@@ -11022,7 +11022,7 @@ static const vshCmdOptDef opts_migrate[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("connection URI of the destination host as seen from the client(normal migration) or source(p2p migration)")
     },
     VIRSH_COMMON_OPT_LIVE(N_("live migration")),
@@ -11117,25 +11117,25 @@ static const vshCmdOptDef opts_migrate[] = {
     {.name = "migrateuri",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("migration URI, usually can be omitted")
     },
     {.name = "graphicsuri",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("graphics URI to be used for seamless graphics migration")
     },
     {.name = "listen-address",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("listen address that destination should bind to for incoming migration")
     },
     {.name = "dname",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("rename to new name during migration (if supported)")
     },
     {.name = "timeout",
@@ -11155,7 +11155,7 @@ static const vshCmdOptDef opts_migrate[] = {
     {.name = "xml",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("filename containing updated XML for the target")
     },
     {.name = "migrate-disks",
@@ -11176,7 +11176,7 @@ static const vshCmdOptDef opts_migrate[] = {
     },
     {.name = "disks-uri",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("URI to use for disks migration (overrides --disks-port)")
     },
     {.name = "comp-methods",
@@ -11210,7 +11210,7 @@ static const vshCmdOptDef opts_migrate[] = {
     },
     {.name = "persistent-xml",
      .type = VSH_OT_STRING,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("filename containing updated persistent XML for the target")
     },
     {.name = "tls",
@@ -11235,7 +11235,7 @@ static const vshCmdOptDef opts_migrate[] = {
     },
     {.name = "tls-destination",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("override the destination host name used for TLS verification")
     },
     {.name = "comp-zlib-level",
@@ -13673,7 +13673,7 @@ static const vshCmdOptDef opts_set_user_sshkeys[] = {
     {.name = "file",
      .type = VSH_OT_STRING,
      .positional = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("optional file to read keys from"),
     },
     {.name = "reset",
index 7a4c2b20d5eaeb39c6d13f23fd468c93ff1f8c28..16f9411730ece614462b0f2912867f1b10eae6d7 100644 (file)
@@ -45,7 +45,7 @@ static const vshCmdInfo info_capabilities = {
 static const vshCmdOptDef opts_capabilities[] = {
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
@@ -107,7 +107,7 @@ static const vshCmdOptDef opts_domcapabilities[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
@@ -1667,7 +1667,7 @@ static const vshCmdOptDef opts_hypervisor_cpu_baseline[] = {
     {.name = "file",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("file containing XML CPU descriptions"),
     },
     {.name = "virttype",
index 7e3103adf13856230b3f884f83bc6e46f3ee8dcc..624d3283a24be400b2931b1e10c9c1720a6a3830 100644 (file)
@@ -453,7 +453,7 @@ static const vshCmdOptDef opts_interface_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
index 5382070031085f8b384d81281e3841468d246350..3fd22db2b07d39894d669f4d652a4697b18e244f 100644 (file)
@@ -506,7 +506,7 @@ static const vshCmdOptDef opts_network_metadata[] = {
     {.name = "set",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("new metadata to set"),
     },
     {.name = "remove",
@@ -638,7 +638,7 @@ static const vshCmdOptDef opts_network_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
@@ -1234,7 +1234,7 @@ static const vshCmdOptDef opts_network_update[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("name of file containing xml (or, if it starts with '<', the complete "
                 "xml element itself) to add/modify, or to be matched for search")
     },
@@ -1871,7 +1871,7 @@ static const vshCmdOptDef opts_network_port_dumpxml[] = {
     VIRSH_COMMON_OPT_NETWORK_PORT(0),
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
index 7ae61275135c96b6a4d122f14545282deb6cce84..2ce0c1411fc959b6f5c204daea1ee4ffccda9561 100644 (file)
@@ -590,7 +590,7 @@ static const vshCmdOptDef opts_node_device_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
index 3745abb67e57f44cf9d991709cfce500959dbc7b..0348584f23b5f04369a446212a9bc339d1a7824e 100644 (file)
@@ -175,7 +175,7 @@ static const vshCmdOptDef opts_nwfilter_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
@@ -576,7 +576,7 @@ static const vshCmdOptDef opts_nwfilter_binding_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
index 089fde55e25608855e05b7ff22c37aa5f9a89f9f..2010ef13568082284c52486cc87571b43130233f 100644 (file)
@@ -57,7 +57,7 @@
      .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
-     .completer = virshCompleteEmpty, \
+     .completer = vshCompleteEmpty, \
      .help = N_("name of the pool") \
     }, \
     {.name = "type", \
@@ -74,7 +74,7 @@
     {.name = "source-host", \
      .type = VSH_OT_STRING, \
      .unwanted_positional = true, \
-     .completer = virshCompleteEmpty, \
+     .completer = vshCompleteEmpty, \
      .help = N_("source-host for underlying storage") \
     }, \
     {.name = "source-path", \
     {.name = "auth-username", \
      .type = VSH_OT_STRING, \
      .unwanted_positional = true, \
-     .completer = virshCompleteEmpty, \
+     .completer = vshCompleteEmpty, \
      .help = N_("auth username to be used for underlying storage") \
     }, \
     {.name = "secret-usage", \
     {.name = "source-initiator", \
      .type = VSH_OT_STRING, \
      .unwanted_positional = true, \
-     .completer = virshCompleteEmpty, \
+     .completer = vshCompleteEmpty, \
      .help = N_("initiator iqn for underlying storage") \
     }
 
@@ -745,7 +745,7 @@ static const vshCmdOptDef opts_pool_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
@@ -1375,19 +1375,19 @@ static const vshCmdOptDef opts_find_storage_pool_sources_as[] = {
     {.name = "host",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("optional host to query")
     },
     {.name = "port",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("optional port to query")
     },
     {.name = "initiator",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("optional initiator IQN to use for query")
     },
     {.name = NULL}
@@ -1462,7 +1462,7 @@ static const vshCmdOptDef opts_find_storage_pool_sources[] = {
     {.name = "srcSpec",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("optional file of source xml to query for pools")
     },
     {.name = NULL}
index 68b14a5276d0b594c9190984d92358d13f27e2a1..26ecb41073e7177adc51c4ddd552b7d935a09d43 100644 (file)
@@ -131,7 +131,7 @@ static const vshCmdOptDef opts_secret_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
@@ -186,7 +186,7 @@ static const vshCmdOptDef opts_secret_set_value[] = {
     },
     {.name = "file",
      .type = VSH_OT_STRING,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("read secret from file"),
     },
     {.name = "plain",
@@ -200,7 +200,7 @@ static const vshCmdOptDef opts_secret_set_value[] = {
     {.name = "base64",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("base64-encoded secret value")
     },
     {.name = NULL}
index dbd849bb3b4a065d8d2e899cff1b791259992138..8e5b9d635c0bca6b511dd0e9f5f3cc7f7eff4c9f 100644 (file)
@@ -110,7 +110,7 @@ static const vshCmdOptDef opts_snapshot_create[] = {
     {.name = "xmlfile",
      .type = VSH_OT_STRING,
      .positional = true,
-     .completer = virshCompletePathLocalExisting,
+     .completer = vshCompletePathLocalExisting,
      .help = N_("domain snapshot XML")
     },
     {.name = "redefine",
@@ -315,13 +315,13 @@ static const vshCmdOptDef opts_snapshot_create_as[] = {
     {.name = "name",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("name of snapshot")
     },
     {.name = "description",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("description of snapshot")
     },
     {.name = "print-xml",
@@ -1593,7 +1593,7 @@ static const vshCmdOptDef opts_snapshot_dumpxml[] = {
     },
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
index 7b1847d7aeb7f91d1974b1f889dbf226157df9f2..7346d628d55d01fed145e424bc4784d397841b0c 100644 (file)
@@ -178,20 +178,20 @@ static const vshCmdOptDef opts_vol_create_as[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("name of the volume")
     },
     {.name = "capacity",
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("size of the vol, as scaled integer (default bytes)")
     },
     {.name = "allocation",
      .type = VSH_OT_STRING,
      .unwanted_positional = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("initial allocation size, as scaled integer (default bytes)")
     },
     {.name = "format",
@@ -531,7 +531,7 @@ static const vshCmdOptDef opts_vol_clone[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("clone name")
     },
     VIRSH_COMMON_OPT_POOL_OPTIONAL,
@@ -1041,7 +1041,7 @@ static const vshCmdOptDef opts_vol_resize[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("new capacity for the vol, as scaled integer (default bytes)")
     },
     VIRSH_COMMON_OPT_POOL_OPTIONAL,
@@ -1129,7 +1129,7 @@ static const vshCmdOptDef opts_vol_dumpxml[] = {
     VIRSH_COMMON_OPT_POOL_OPTIONAL,
     {.name = "xpath",
      .type = VSH_OT_STRING,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("xpath expression to filter the XML document")
     },
     {.name = "wrap",
index c893216637d26f09a6afcea701a2c0821a839200..244ca655ee997439d044278b0ac0d1a5f2dd3d2a 100644 (file)
@@ -248,7 +248,7 @@ static const vshCmdOptDef opts_connect[] = {
      .type = VSH_OT_STRING,
      .positional = true,
      .allowEmpty = true,
-     .completer = virshCompleteEmpty,
+     .completer = vshCompleteEmpty,
      .help = N_("hypervisor connection URI")
     },
     {.name = "readonly",
index 90ffc4bf18228e53218fc5d320a1d59c1c75b739..0e4c368c9b22b6a0159acff638b75d6b1e288161 100644 (file)
      .type = VSH_OT_STRING, \
      .required = true, \
      .positional = true, \
-     .completer = virshCompletePathLocalExisting, \
+     .completer = vshCompletePathLocalExisting, \
      .help = _helpstr \
     }
 
similarity index 85%
rename from tools/virsh-completer.c
rename to tools/vsh-completer.c
index d4defba86e38d2b90aa6860b857a94a904372b91..8f0376879cdb05b271c4ac71837e952d370ad743 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * virsh-completer.c: virsh completer callbacks
+ * vsh-completer.c: virsh completer callbacks
  *
  * Copyright (C) 2017 Red Hat, Inc.
  *
@@ -20,7 +20,7 @@
 
 #include <config.h>
 
-#include "virsh-completer.h"
+#include "vsh-completer.h"
 
 /**
  * A completer callback is a function that accepts three arguments:
@@ -56,7 +56,7 @@
 
 
 /**
- * virshEnumComplete:
+ * vshEnumComplete:
  * @last: The number of element in enum (pass VIR_XXX_LAST)
  * @intToStr: integer to string conversion (pass virXXXTypeToString)
  *
@@ -67,8 +67,8 @@
  * Returns: string list of completions.
  */
 char **
-virshEnumComplete(unsigned int last,
-                  const char *(*intToStr)(int))
+vshEnumComplete(unsigned int last,
+                const char *(*intToStr)(int))
 {
     char **ret = NULL;
     size_t i;
@@ -83,7 +83,7 @@ virshEnumComplete(unsigned int last,
 
 
 /**
- * virshCommaStringListComplete:
+ * vshCommaStringListComplete:
  * @input: user input so far
  * @options: ALL options available for argument
  *
@@ -102,15 +102,15 @@ virshEnumComplete(unsigned int last,
  * This helper function takes care of that. In this specific case
  * it would be called as follows:
  *
- *   virshCommaStringListComplete("str1,str2,str3",
+ *   vshCommaStringListComplete("str1,str2,str3",
  *                                {"strA", "strB", "strC", NULL});
  *
  * Returns: string list of completions on success,
  *          NULL otherwise.
  */
 char **
-virshCommaStringListComplete(const char *input,
-                             const char **options)
+vshCommaStringListComplete(const char *input,
+                           const char **options)
 {
     const size_t optionsLen = g_strv_length((char **) options);
     g_autofree char *inputCopy = NULL;
@@ -156,7 +156,7 @@ virshCommaStringListComplete(const char *input,
 
 
 /**
- * virshCompletePathLocalExisting:
+ * vshCompletePathLocalExisting:
  *
  * Complete a path to a existing file used as input. The file is used as input
  * for virsh so only local files are considered.
@@ -164,16 +164,16 @@ virshCommaStringListComplete(const char *input,
  * Note: For now this is a no-op. Readline does the correct thing.
  */
 char **
-virshCompletePathLocalExisting(vshControl *ctl G_GNUC_UNUSED,
-                               const vshCmd *cmd G_GNUC_UNUSED,
-                               unsigned int completerflags G_GNUC_UNUSED)
+vshCompletePathLocalExisting(vshControl *ctl G_GNUC_UNUSED,
+                             const vshCmd *cmd G_GNUC_UNUSED,
+                             unsigned int completerflags G_GNUC_UNUSED)
 {
     return NULL;
 }
 
 
 /**
- * virshCompleteEmpty:
+ * vshCompleteEmpty:
  *
  * Complete nothing. For cases where an user input is required and we can't
  * suggest anything.
@@ -182,9 +182,9 @@ virshCompletePathLocalExisting(vshControl *ctl G_GNUC_UNUSED,
  * file list.
  */
 char **
-virshCompleteEmpty(vshControl *ctl G_GNUC_UNUSED,
-                   const vshCmd *cmd G_GNUC_UNUSED,
-                   unsigned int completerflags G_GNUC_UNUSED)
+vshCompleteEmpty(vshControl *ctl G_GNUC_UNUSED,
+                 const vshCmd *cmd G_GNUC_UNUSED,
+                 unsigned int completerflags G_GNUC_UNUSED)
 {
     return NULL;
 }
diff --git a/tools/vsh-completer.h b/tools/vsh-completer.h
new file mode 100644 (file)
index 0000000..b479156
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * vsh-completer.h: common virt shell completer callbacks
+ *
+ * Copyright (C) 2017 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include "vsh.h"
+
+char **
+vshEnumComplete(unsigned int last,
+                const char *(*intToStr)(int));
+
+char **
+vshCommaStringListComplete(const char *input,
+                           const char **options);
+
+char **
+vshCompletePathLocalExisting(vshControl *ctl,
+                             const vshCmd *cmd,
+                             unsigned int completerflags);
+
+char **
+vshCompleteEmpty(vshControl *ctl,
+                 const vshCmd *cmd,
+                 unsigned int completerflags);