[
'vsh.c',
'vsh-table.c',
+ 'vsh-completer.c',
],
dependencies: [
tools_dep,
'virsh.c',
'virsh-backup.c',
'virsh-checkpoint.c',
- 'virsh-completer.c',
'virsh-completer-domain.c',
'virsh-completer-checkpoint.c',
'virsh-completer-host.c',
{.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",
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",
{.name = "xmlfile",
.type = VSH_OT_STRING,
.positional = true,
- .completer = virshCompletePathLocalExisting,
+ .completer = vshCompletePathLocalExisting,
.help = N_("domain checkpoint XML")
},
{.name = "redefine",
{.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",
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
{.name = "wrap",
if (!targets)
return NULL;
- return virshCommaStringListComplete(curval, (const char **) targets);
+ return vshCommaStringListComplete(curval, (const char **) targets);
}
if (!groups)
return NULL;
- return virshCommaStringListComplete(curval, (const char **) groups);
+ return vshCommaStringListComplete(curval, (const char **) groups);
}
if (vshCommandOptStringQuiet(ctl, cmd, "mode", &mode) < 0)
return NULL;
- return virshCommaStringListComplete(mode, modes);
+ return vshCommaStringListComplete(mode, modes);
}
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LAST,
- virshDomainInterfaceAddressesSourceTypeToString);
+ return vshEnumComplete(VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LAST,
+ virshDomainInterfaceAddressesSourceTypeToString);
}
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIRSH_DOMAIN_INTERFACE_SOURCE_MODE_LAST,
- virshDomainInterfaceSourceModeTypeToString);
+ return vshEnumComplete(VIRSH_DOMAIN_INTERFACE_SOURCE_MODE_LAST,
+ virshDomainInterfaceSourceModeTypeToString);
}
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIRSH_DOMAIN_HOSTNAME_SOURCE_LAST,
- virshDomainHostnameSourceTypeToString);
+ return vshEnumComplete(VIRSH_DOMAIN_HOSTNAME_SOURCE_LAST,
+ virshDomainHostnameSourceTypeToString);
}
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);
}
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);
}
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);
}
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);
}
}
}
- ret = virshCommaStringListComplete(vcpuid, (const char **)cpulist);
+ ret = vshCommaStringListComplete(vcpuid, (const char **)cpulist);
cleanup:
virTypedParamsFree(params, nparams);
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIR_DOMAIN_PROCESS_SIGNAL_LAST,
- virshDomainProcessSignalTypeToString);
+ return vshEnumComplete(VIR_DOMAIN_PROCESS_SIGNAL_LAST,
+ virshDomainProcessSignalTypeToString);
}
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIR_DOMAIN_LIFECYCLE_LAST,
- virshDomainLifecycleTypeToString);
+ return vshEnumComplete(VIR_DOMAIN_LIFECYCLE_LAST,
+ virshDomainLifecycleTypeToString);
}
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIR_DOMAIN_LIFECYCLE_ACTION_LAST,
- virshDomainLifecycleActionTypeToString);
+ return vshEnumComplete(VIR_DOMAIN_LIFECYCLE_ACTION_LAST,
+ virshDomainLifecycleActionTypeToString);
}
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIR_KEYCODE_SET_LAST,
- virKeycodeSetTypeToString);
+ return vshEnumComplete(VIR_KEYCODE_SET_LAST,
+ virKeycodeSetTypeToString);
}
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIR_DOMAIN_CORE_DUMP_FORMAT_LAST,
- virshDomainCoreDumpFormatTypeToString);
+ return vshEnumComplete(VIR_DOMAIN_CORE_DUMP_FORMAT_LAST,
+ virshDomainCoreDumpFormatTypeToString);
}
if (vshCommandOptStringQuiet(ctl, cmd, "comp-methods", &method) < 0)
return NULL;
- return virshCommaStringListComplete(method, methods);
+ return vshCommaStringListComplete(method, methods);
}
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIR_STORAGE_FILE_LAST,
- virStorageFileFormatTypeToString);
+ return vshEnumComplete(VIR_STORAGE_FILE_LAST,
+ virStorageFileFormatTypeToString);
}
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIR_DOMAIN_NUMATUNE_MEM_LAST,
- virDomainNumatuneMemModeTypeToString);
+ return vshEnumComplete(VIR_DOMAIN_NUMATUNE_MEM_LAST,
+ virDomainNumatuneMemModeTypeToString);
}
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIRSH_DOMAIN_DIRTYRATE_CALC_MODE_LAST,
- virshDomainDirtyRateCalcModeTypeToString);
+ return vshEnumComplete(VIRSH_DOMAIN_DIRTYRATE_CALC_MODE_LAST,
+ virshDomainDirtyRateCalcModeTypeToString);
}
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIR_NODE_SUSPEND_TARGET_LAST,
- virshNodeSuspendTargetTypeToString);
+ return vshEnumComplete(VIR_NODE_SUSPEND_TARGET_LAST,
+ virshNodeSuspendTargetTypeToString);
}
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIR_DOMAIN_VIRT_LAST,
- virDomainVirtTypeToString);
+ return vshEnumComplete(VIR_DOMAIN_VIRT_LAST,
+ virDomainVirtTypeToString);
}
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIR_ARCH_LAST,
- (const char *(*)(int))virArchToString);
+ return vshEnumComplete(VIR_ARCH_LAST,
+ (const char *(*)(int))virArchToString);
}
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);
}
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST,
- virDeviceHostdevPCIDriverNameTypeToString);
+ return vshEnumComplete(VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST,
+ virDeviceHostdevPCIDriverNameTypeToString);
}
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);
if (vshCommandOptStringQuiet(ctl, cmd, "type", &type_str) < 0)
return NULL;
- return virshCommaStringListComplete(type_str, (const char **)tmp);
+ return vshCommaStringListComplete(type_str, (const char **)tmp);
}
{
virCheckFlags(0, NULL);
- return virshEnumComplete(VIR_STORAGE_VOL_WIPE_ALG_LAST,
- virshStorageVolWipeAlgorithmTypeToString);
+ return vshEnumComplete(VIR_STORAGE_VOL_WIPE_ALG_LAST,
+ virshStorageVolWipeAlgorithmTypeToString);
}
#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);
.type = VSH_OT_STRING,
.positional = true,
.required = true,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("target of disk device")
},
{.name = "targetbus",
},
{.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",
},
{.name = "address",
.type = VSH_OT_STRING,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("address of disk device")
},
{.name = "multifunction",
},
{.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",
{.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",
{.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,
},
{.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,
{.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,
{.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",
{.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,
{.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",
{.name = "xml",
.type = VSH_OT_STRING,
.unwanted_positional = true,
- .completer = virshCompletePathLocalExisting,
+ .completer = vshCompletePathLocalExisting,
.help = N_("filename containing updated XML for the target")
},
{.name = "running",
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
{.name = "wrap",
.type = VSH_OT_STRING,
.positional = true,
.required = true,
- .completer = virshCompletePathLocalExisting,
+ .completer = vshCompletePathLocalExisting,
.help = N_("filename containing updated XML for the target")
},
{.name = "running",
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
{.name = "wrap",
.type = VSH_OT_STRING,
.positional = true,
.required = true,
- .completer = virshCompletePathLocalExisting,
+ .completer = vshCompletePathLocalExisting,
.help = N_("filename containing updated XML for the target")
},
{.name = "running",
{.name = "xml",
.type = VSH_OT_STRING,
.unwanted_positional = true,
- .completer = virshCompletePathLocalExisting,
+ .completer = vshCompletePathLocalExisting,
.help = N_("filename containing updated XML for the target")
},
{.name = "running",
{.name = "file",
.type = VSH_OT_STRING,
.unwanted_positional = true,
- .completer = virshCompletePathLocalExisting,
+ .completer = vshCompletePathLocalExisting,
.help = N_("where to store the screenshot")
},
{.name = "screen",
.type = VSH_OT_STRING,
.positional = true,
.required = true,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("the new password")
},
{.name = "encrypted",
{.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",
{.name = "set",
.type = VSH_OT_STRING,
.unwanted_positional = true,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("new metadata to set"),
},
{.name = "remove",
.type = VSH_OT_STRING,
.positional = true,
.required = true,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("the process ID")
},
{.name = "signame",
.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",
},
{.name = "pass-fds",
.type = VSH_OT_STRING,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("pass file descriptors N,M,... along with the command")
},
{.name = "cmd",
.type = VSH_OT_STRING,
.positional = true,
.required = true,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("pid")
},
{.name = NULL}
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
{.name = "wrap",
.type = VSH_OT_STRING,
.positional = true,
.required = true,
- .completer = virshCompletePathLocalExisting,
+ .completer = vshCompletePathLocalExisting,
.help = N_("config data file to import from")
},
{.name = NULL}
{.name = "xml",
.type = VSH_OT_STRING,
.unwanted_positional = true,
- .completer = virshCompletePathLocalExisting,
+ .completer = vshCompletePathLocalExisting,
.help = N_("xml data file to export from")
},
{.name = NULL}
.type = VSH_OT_STRING,
.positional = true,
.required = true,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("new domain name")
},
{.name = NULL}
.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")),
{.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",
{.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",
},
{.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",
},
{.name = "persistent-xml",
.type = VSH_OT_STRING,
- .completer = virshCompletePathLocalExisting,
+ .completer = vshCompletePathLocalExisting,
.help = N_("filename containing updated persistent XML for the target")
},
{.name = "tls",
},
{.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",
{.name = "file",
.type = VSH_OT_STRING,
.positional = true,
- .completer = virshCompletePathLocalExisting,
+ .completer = vshCompletePathLocalExisting,
.help = N_("optional file to read keys from"),
},
{.name = "reset",
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",
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
{.name = "wrap",
{.name = "file",
.type = VSH_OT_STRING,
.unwanted_positional = true,
- .completer = virshCompletePathLocalExisting,
+ .completer = vshCompletePathLocalExisting,
.help = N_("file containing XML CPU descriptions"),
},
{.name = "virttype",
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
{.name = "wrap",
{.name = "set",
.type = VSH_OT_STRING,
.unwanted_positional = true,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("new metadata to set"),
},
{.name = "remove",
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
{.name = "wrap",
.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")
},
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",
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
{.name = "wrap",
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
{.name = "wrap",
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
{.name = "wrap",
.type = VSH_OT_STRING, \
.positional = true, \
.required = true, \
- .completer = virshCompleteEmpty, \
+ .completer = vshCompleteEmpty, \
.help = N_("name of the pool") \
}, \
{.name = "type", \
{.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") \
}
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
{.name = "wrap",
{.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}
{.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}
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
{.name = "wrap",
},
{.name = "file",
.type = VSH_OT_STRING,
- .completer = virshCompletePathLocalExisting,
+ .completer = vshCompletePathLocalExisting,
.help = N_("read secret from file"),
},
{.name = "plain",
{.name = "base64",
.type = VSH_OT_STRING,
.unwanted_positional = true,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("base64-encoded secret value")
},
{.name = NULL}
{.name = "xmlfile",
.type = VSH_OT_STRING,
.positional = true,
- .completer = virshCompletePathLocalExisting,
+ .completer = vshCompletePathLocalExisting,
.help = N_("domain snapshot XML")
},
{.name = "redefine",
{.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",
},
{.name = "xpath",
.type = VSH_OT_STRING,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
{.name = "wrap",
.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",
.type = VSH_OT_STRING,
.positional = true,
.required = true,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("clone name")
},
VIRSH_COMMON_OPT_POOL_OPTIONAL,
.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,
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",
.type = VSH_OT_STRING,
.positional = true,
.allowEmpty = true,
- .completer = virshCompleteEmpty,
+ .completer = vshCompleteEmpty,
.help = N_("hypervisor connection URI")
},
{.name = "readonly",
.type = VSH_OT_STRING, \
.required = true, \
.positional = true, \
- .completer = virshCompletePathLocalExisting, \
+ .completer = vshCompletePathLocalExisting, \
.help = _helpstr \
}
/*
- * virsh-completer.c: virsh completer callbacks
+ * vsh-completer.c: virsh completer callbacks
*
* Copyright (C) 2017 Red Hat, Inc.
*
#include <config.h>
-#include "virsh-completer.h"
+#include "vsh-completer.h"
/**
* A completer callback is a function that accepts three arguments:
/**
- * virshEnumComplete:
+ * vshEnumComplete:
* @last: The number of element in enum (pass VIR_XXX_LAST)
* @intToStr: integer to string conversion (pass virXXXTypeToString)
*
* 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;
/**
- * virshCommaStringListComplete:
+ * vshCommaStringListComplete:
* @input: user input so far
* @options: ALL options available for argument
*
* 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;
/**
- * 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.
* 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.
* 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;
}
--- /dev/null
+/*
+ * 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);