From: Peter Krempa <pkrempa(a)redhat.com>
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(a)redhat.com>
---
tools/meson.build | 2 +-
tools/virsh-backup.c | 6 +-
tools/virsh-checkpoint.c | 8 +-
tools/virsh-completer-domain.c | 70 ++++++-------
tools/virsh-completer-host.c | 12 +--
tools/virsh-completer-nodedev.c | 10 +-
tools/virsh-completer-pool.c | 6 +-
tools/virsh-completer-volume.c | 4 +-
tools/virsh-completer.h | 19 +---
tools/virsh-domain.c | 100 +++++++++----------
tools/virsh-host.c | 6 +-
tools/virsh-interface.c | 2 +-
tools/virsh-network.c | 8 +-
tools/virsh-nodedev.c | 2 +-
tools/virsh-nwfilter.c | 4 +-
tools/virsh-pool.c | 18 ++--
tools/virsh-secret.c | 6 +-
tools/virsh-snapshot.c | 8 +-
tools/virsh-volume.c | 12 +--
tools/virsh.c | 2 +-
tools/virsh.h | 2 +-
tools/{virsh-completer.c => vsh-completer.c} | 34 +++----
tools/vsh-completer.h | 41 ++++++++
23 files changed, 203 insertions(+), 179 deletions(-)
rename tools/{virsh-completer.c => vsh-completer.c} (85%)
create mode 100644 tools/vsh-completer.h
diff --git a/tools/meson.build b/tools/meson.build
index 4d5c9e4bba..a099148d3c 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -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',
diff --git a/tools/virsh-backup.c b/tools/virsh-backup.c
index 27777eea74..39e62f9ba9 100644
--- a/tools/virsh-backup.c
+++ b/tools/virsh-backup.c
@@ -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",
diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c
index a0ac0d7f71..1a168a1c38 100644
--- a/tools/virsh-checkpoint.c
+++ b/tools/virsh-checkpoint.c
@@ -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",
diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c
index 3a165bc4a5..912826c434 100644
--- a/tools/virsh-completer-domain.c
+++ b/tools/virsh-completer-domain.c
@@ -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);
}
diff --git a/tools/virsh-completer-host.c b/tools/virsh-completer-host.c
index 78d2236f97..c3919a6d91 100644
--- a/tools/virsh-completer-host.c
+++ b/tools/virsh-completer-host.c
@@ -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);
}
diff --git a/tools/virsh-completer-nodedev.c b/tools/virsh-completer-nodedev.c
index 72951a54f6..289f803904 100644
--- a/tools/virsh-completer-nodedev.c
+++ b/tools/virsh-completer-nodedev.c
@@ -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);
}
diff --git a/tools/virsh-completer-pool.c b/tools/virsh-completer-pool.c
index 3568bb985b..6701436c0f 100644
--- a/tools/virsh-completer-pool.c
+++ b/tools/virsh-completer-pool.c
@@ -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);
}
diff --git a/tools/virsh-completer-volume.c b/tools/virsh-completer-volume.c
index 9a80112e59..5ad2e28318 100644
--- a/tools/virsh-completer-volume.c
+++ b/tools/virsh-completer-volume.c
@@ -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);
}
diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h
index 131678dfbc..2ddd5446cd 100644
--- a/tools/virsh-completer.h
+++ b/tools/virsh-completer.h
@@ -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"
@@ -31,21 +32,3 @@
#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);
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index a5f87243a2..7e5e83126e 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -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",
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 7a4c2b20d5..16f9411730 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -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",
diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
index 7e3103adf1..624d3283a2 100644
--- a/tools/virsh-interface.c
+++ b/tools/virsh-interface.c
@@ -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",
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index 5382070031..3fd22db2b0 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -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",
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index 7ae6127513..2ce0c1411f 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -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",
diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c
index 3745abb67e..0348584f23 100644
--- a/tools/virsh-nwfilter.c
+++ b/tools/virsh-nwfilter.c
@@ -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",
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 089fde55e2..2010ef1356 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -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", \
@@ -110,7 +110,7 @@
{.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", \
@@ -166,7 +166,7 @@
{.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}
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index 68b14a5276..26ecb41073 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -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}
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index dbd849bb3b..8e5b9d635c 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -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",
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index 7b1847d7ae..7346d628d5 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -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",
diff --git a/tools/virsh.c b/tools/virsh.c
index c893216637..244ca655ee 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -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",
diff --git a/tools/virsh.h b/tools/virsh.h
index 90ffc4bf18..0e4c368c9b 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -102,7 +102,7 @@
.type = VSH_OT_STRING, \
.required = true, \
.positional = true, \
- .completer = virshCompletePathLocalExisting, \
+ .completer = vshCompletePathLocalExisting, \
.help = _helpstr \
}
diff --git a/tools/virsh-completer.c b/tools/vsh-completer.c
similarity index 85%
rename from tools/virsh-completer.c
rename to tools/vsh-completer.c
index d4defba86e..8f0376879c 100644
--- a/tools/virsh-completer.c
+++ b/tools/vsh-completer.c
@@ -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
index 0000000000..b479156062
--- /dev/null
+++ b/tools/vsh-completer.h
@@ -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);
--
2.49.0