[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [v4 0/5] virsh: More intelligent auto-completion

This series implements advanced auto-completion for virsh. Using custom option
completers (examples in 3/5, 4/5 and 5/5), it is possible to further complete
any option with defined completer function.

Option completer function should return list of completed names for each desired
option. Using C99 initialization, it is easy to enable specific completer for
any option. For example, when we want domain completer for "start --domain"
option, we write vshDomainCompleter() and along with desired flags, initialize
targeted opts struct.

static const vshCmdOptDef opts_start[] = {
    {.name = "domain",
     .type = VSH_OT_DATA,
     .flags = VSH_OFLAG_REQ,
     .help = N_("name of the inactive domain"),

     .completer = vshDomainCompleter,
     .completer_flags = VIR_CONNECT_LIST_DOMAINS_INACTIVE |

Auto-completion itself then works like this:

 virsh # start --domain <TAB>
  domain1 domain2 domainN

 virsh # vol-key <TAB>
  --help --pool --vol vol1 vol2

* rewritten to use only option completers




Tomas Meszaros (5):
  virsh: Add vshCmdCompleter and vshOptCompleter
  virsh: Improve readline generators and readline completion
  virsh: Add vshDomainCompleter
  virsh: Add vshSuspendTargetCompleter
  virsh: Add vshRebootShutdownModeCompleter

 tools/virsh-domain-monitor.c |  52 +++++--
 tools/virsh-domain.c         | 310 +++++++++++++++++++++++++++++---------
 tools/virsh-snapshot.c       |  50 +++++--
 tools/virsh.c                | 350 +++++++++++++++++++++++++++++++++++++++----
 tools/virsh.h                |   8 +
 5 files changed, 648 insertions(+), 122 deletions(-)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]