mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virsh: Add virshCodesetNameCompleter
This completer offers completion for --codeset argument of send-key command. Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
fa3d8a609a
commit
040a5bc307
@ -31,6 +31,7 @@
|
|||||||
#include "virxml.h"
|
#include "virxml.h"
|
||||||
#include "virperf.h"
|
#include "virperf.h"
|
||||||
#include "virbitmap.h"
|
#include "virbitmap.h"
|
||||||
|
#include "virkeycode.h"
|
||||||
|
|
||||||
char **
|
char **
|
||||||
virshDomainNameCompleter(vshControl *ctl,
|
virshDomainNameCompleter(vshControl *ctl,
|
||||||
@ -778,3 +779,24 @@ virshDomainLifecycleActionCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
|
|
||||||
return g_steal_pointer(&tmp);
|
return g_steal_pointer(&tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char **
|
||||||
|
virshCodesetNameCompleter(vshControl *ctl G_GNUC_UNUSED,
|
||||||
|
const vshCmd *cmd G_GNUC_UNUSED,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
g_auto(GStrv) tmp = NULL;
|
||||||
|
size_t i = 0;
|
||||||
|
|
||||||
|
virCheckFlags(0, NULL);
|
||||||
|
|
||||||
|
tmp = g_new0(char *, VIR_KEYCODE_SET_LAST + 1);
|
||||||
|
|
||||||
|
for (i = 0; i < VIR_KEYCODE_SET_LAST; i++) {
|
||||||
|
const char *name = virKeycodeSetTypeToString(i);
|
||||||
|
tmp[i] = g_strdup(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_steal_pointer(&tmp);
|
||||||
|
}
|
||||||
|
@ -110,3 +110,7 @@ char ** virshDomainLifecycleCompleter(vshControl *ctl,
|
|||||||
char ** virshDomainLifecycleActionCompleter(vshControl *ctl,
|
char ** virshDomainLifecycleActionCompleter(vshControl *ctl,
|
||||||
const vshCmd *cmd,
|
const vshCmd *cmd,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
char ** virshCodesetNameCompleter(vshControl *ctl,
|
||||||
|
const vshCmd *cmd,
|
||||||
|
unsigned int flags);
|
||||||
|
@ -8791,6 +8791,7 @@ static const vshCmdOptDef opts_send_key[] = {
|
|||||||
{.name = "codeset",
|
{.name = "codeset",
|
||||||
.type = VSH_OT_STRING,
|
.type = VSH_OT_STRING,
|
||||||
.flags = VSH_OFLAG_REQ_OPT,
|
.flags = VSH_OFLAG_REQ_OPT,
|
||||||
|
.completer = virshCodesetNameCompleter,
|
||||||
.help = N_("the codeset of keycodes, default:linux")
|
.help = N_("the codeset of keycodes, default:linux")
|
||||||
},
|
},
|
||||||
{.name = "holdtime",
|
{.name = "holdtime",
|
||||||
|
Loading…
Reference in New Issue
Block a user