[PATCH v2 0/5] virsh: Add missing TAB completers for several commands

Radosław Śmigielski via Devel posted 5 patches 1 day, 10 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1783937691.git.rsmigiel@redhat.com
tools/virsh-completer-domain.c | 122 +++++++++++++++++++++++++++++++++
tools/virsh-completer-domain.h |  40 +++++++++++
tools/virsh-domain.c           |  16 ++++-
tools/virsh-volume.c           |   2 +
tools/vsh-completer.c          |  18 +++++
tools/vsh-completer.h          |   5 ++
6 files changed, 202 insertions(+), 1 deletion(-)
[PATCH v2 0/5] virsh: Add missing TAB completers for several commands
Posted by Radosław Śmigielski via Devel 1 day, 10 hours ago
From: Radoslaw Smigielski <rsmigiel@redhat.com>

These changes add missing virsh TAB completion callbacks for several commands.
Fixed or added completers covers command grouped by similar options:

output paths:
  - dump --file
  - save --file
  - blockcopy --dest
  - screenshot --file (fixes pre-existing wrong annotation)

display / native format:
  - domdisplay --type
  - domxml-from-native --format
  - domxml-to-native --format

storage volume formats:
  - vol-create-as --format
  - vol-create-as --backing-vol-format

attach-disk:
  - targetbus, type, cache, io, mode, sourcetype, subdriver
  - source-host-socket

In patch 1/5 added vshCompletePathLocalCreate, a new noop completer
for local file paths used as command output where the target file may
not exist yet. This is the counterpart to vshCompletePathLocalExisting,
which is for existing files used as input.

In patch 2/5 adds a completer for domdisplay --type using
virDomainGraphicsTypeToString and VIR_DOMAIN_GRAPHICS_TYPE_LAST
so the options stays in sync with libvirt graphics types.
Replaced the static list from first patch set.

In patch 3/5 adds virshDomainXMLNativeFormatCompleter for domxml-from-native
--format (hypervisor-dependent native config format list).
In virshDomainXMLNativeFormatCompleter() added 4 new "static const char[]"
variables, follow the same pattern appears in the same file. Even though
these variables could be a non-static local arrays.

In patch 4/5 reuses existing completers for domxml-to-native --format and
vol-create-as --format / --backing-vol-format.

In 5/5 adds few enum and static-list completers for attach-disk options
targetbus, type, cache, io, mode, and sourcetype, and reuses the storage
file format completer for subdriver.
In virshDomainAttachDiskSourceTypeCompleter, I added a static list of element
types, I did not find any existing variable with the same list content.

Partially-fixes: https://gitlab.com/libvirt/libvirt/-/work_items/9


Radoslaw Smigielski (5):
  virsh: Add vshCompletePathLocalCreate completer for output paths
  virsh: Add completer for '--type' option of 'domdisplay' command
  virsh: Add completer for '--format' option of 'domxml-from-native' command
  virsh: Add missing TAB completers for several options
  virsh: Add missing TAB completers for 'attach-disk' command

 tools/virsh-completer-domain.c | 122 +++++++++++++++++++++++++++++++++
 tools/virsh-completer-domain.h |  40 +++++++++++
 tools/virsh-domain.c           |  16 ++++-
 tools/virsh-volume.c           |   2 +
 tools/vsh-completer.c          |  18 +++++
 tools/vsh-completer.h          |   5 ++
 6 files changed, 202 insertions(+), 1 deletion(-)

-- 
2.54.0