[libvirt] [PATCH v2 00/12] Make auto completion better

Michal Privoznik mprivozn at redhat.com
Fri Nov 24 17:11:22 UTC 2017


On 11/13/2017 05:06 PM, Michal Privoznik wrote:
> v2 of:
> 
> https://www.redhat.com/archives/libvir-list/2017-November/msg00213.html
> 
> diff to v1:
> -cmdComplete reworked
> -Dozen of small improvements
> 
> The command completion is still missing. I mean, 'virsh start<TAB><TAB>' will
> still give you list of --options rather than a list of domains to start with
> it. And honestly, the code is so ugly, that I haven't even tried to implement
> it. Be my guest.
> 
> Michal Privoznik (12):
>   vshCommandParse: Don't leak @tkdata
>   vshCommandStringParse: Allow retrieving partial result
>   vshReadlineParse: Escape returned results if needed
>   vshCommandOpt: Allow caller avoiding assert()
>   vsh: Fix vshCompleter signature
>   vsh: Call vshCmdOptDef.completer properly
>   vshCompleter: Pass partially parsed command
>   vsh: Introduce complete command
>   tools: Provide bash autompletion file
>   virsh: Introduce virshDomainNameCompleter
>   virsh: Introduce virshDomainInterfaceCompleter
>   virt-admin: Introduce vshAdmServerCompleter
> 
>  configure.ac                 |   3 +
>  libvirt.spec.in              |   2 +
>  m4/virt-bash-completion.m4   |  74 ++++++++++++++
>  tools/Makefile.am            |  40 +++++++-
>  tools/bash-completion/vsh    |  67 +++++++++++++
>  tools/virsh-completer.c      | 150 ++++++++++++++++++++++++++++
>  tools/virsh-completer.h      |  41 ++++++++
>  tools/virsh-domain-monitor.c |  33 +++---
>  tools/virsh-domain.c         | 186 +++++++++++++++++-----------------
>  tools/virsh-snapshot.c       |  24 ++---
>  tools/virsh.c                |   5 +-
>  tools/virsh.h                |   7 +-
>  tools/virt-admin-completer.c |  76 ++++++++++++++
>  tools/virt-admin-completer.h |  33 ++++++
>  tools/virt-admin.c           |  13 ++-
>  tools/vsh.c                  | 232 +++++++++++++++++++++++++++++++++----------
>  tools/vsh.h                  |  23 ++++-
>  17 files changed, 831 insertions(+), 178 deletions(-)
>  create mode 100644 m4/virt-bash-completion.m4
>  create mode 100644 tools/bash-completion/vsh
>  create mode 100644 tools/virsh-completer.c
>  create mode 100644 tools/virsh-completer.h
>  create mode 100644 tools/virt-admin-completer.c
>  create mode 100644 tools/virt-admin-completer.h
> 

Self-NACK. I've found a way to throw away parsing code duplication done
in vshReadlineParse(). I'm working on v3.

Michal




More information about the libvir-list mailing list