From nobody Thu May 9 00:30:14 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 207.211.30.44 is neither permitted nor denied by domain of listman.redhat.com) client-ip=207.211.30.44; envelope-from=libvir-list-bounces@listman.redhat.com; helo=us-smtp-delivery-44.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=none (zohomail.com: 207.211.30.44 is neither permitted nor denied by domain of listman.redhat.com) smtp.mailfrom=libvir-list-bounces@listman.redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613506713; cv=none; d=zohomail.com; s=zohoarc; b=kZxgfbfPrU2c0PQe+G13w1k8ehMW7h6Ptf4VJCri3URGuW/NVyuS9YqTS+zsXmOhqbbyl3bpz+AtRZHu7BknmaKBp5nptR7fWatG+oaQpTdeJXLVmIFIg+AWAoxAkYM6grH8f5rbpL13Foj33sb0RubE2rADDhtMDtvKV9GgL4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613506713; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=/BeE//QV1dOtNc13XNIYzbU07psAD68lslMEHRBIpBE=; b=K5BUvmvNMsLaYTnIqYagbK7Kkzkbek22pyezwO3KIz3vVMCopYKsn8P4s1Z+MntS0iPLOXMIBtV6COAx+EHbTmxore//SEpfIN3RMgsm+4f5FhUbhwRBFbVEUdivSD5ozuQ03+79pZVEYscH2cSx1XP6q+8kztXYKOJwsj3GKzw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=none (zohomail.com: 207.211.30.44 is neither permitted nor denied by domain of listman.redhat.com) smtp.mailfrom=libvir-list-bounces@listman.redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [207.211.30.44]) by mx.zohomail.com with SMTPS id 1613506712647365.9685811440813; Tue, 16 Feb 2021 12:18:32 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-277-g85K4-SiNuGXOTclDlUDlg-1; Tue, 16 Feb 2021 15:18:27 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF618107ACE3; Tue, 16 Feb 2021 20:18:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ED8D75C648; Tue, 16 Feb 2021 20:18:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0ABF018095CB; Tue, 16 Feb 2021 20:18:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11GKG0HT000412 for ; Tue, 16 Feb 2021 15:16:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4F22A1002382; Tue, 16 Feb 2021 20:16:00 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.192.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5CB2410016F0 for ; Tue, 16 Feb 2021 20:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613506711; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=/BeE//QV1dOtNc13XNIYzbU07psAD68lslMEHRBIpBE=; b=ff0Wa2HRXwwB72PaUmYOf3oWqat5pb+ffJHRYarTyu4ubnhyKHbBZARMbkakGbI0IAGP3b SnJMSB6RyIkhi01pyU1ZeQlFwjtWsLnblo1j57nhUq2/MP+z1Tx4bCPwdPfqmY6Wx4ijYk atzkzqjt5bhfDft3B44aaQYM393wXiQ= X-MC-Unique: g85K4-SiNuGXOTclDlUDlg-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH] virsh: Add virshCodesetNameCompleter Date: Tue, 16 Feb 2021 21:15:43 +0100 Message-Id: <20210216201543.40913-1-khanicov@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@listman.redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@listman.redhat.com Errors-To: libvir-list-bounces@listman.redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@listman.redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: listman.redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Kristina Hanicova virsh: Add virshCodesetNameCompleter Signed-off-by: Kristina Hanicova Reviewed-by: Michal Privoznik --- tools/virsh-completer-domain.c | 22 ++++++++++++++++++++++ tools/virsh-completer-domain.h | 4 ++++ tools/virsh-domain.c | 1 + 3 files changed, 27 insertions(+) diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c index e773af6552..fc4d7b2e52 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -31,6 +31,7 @@ #include "virxml.h" #include "virperf.h" #include "virbitmap.h" +#include "virkeycode.h" =20 char ** virshDomainNameCompleter(vshControl *ctl, @@ -778,3 +779,24 @@ virshDomainLifecycleActionCompleter(vshControl *ctl G_= GNUC_UNUSED, =20 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 =3D NULL; + size_t i =3D 0; + + virCheckFlags(0, NULL); + + tmp =3D g_new0(char *, VIR_KEYCODE_SET_LAST + 1); + + for (i =3D 0; i < VIR_KEYCODE_SET_LAST; i++) { + const char *name =3D virKeycodeSetTypeToString(i); + tmp[i] =3D g_strdup(name); + } + + return g_steal_pointer(&tmp); +} diff --git a/tools/virsh-completer-domain.h b/tools/virsh-completer-domain.h index 92c57bce75..4c01b0ca1f 100644 --- a/tools/virsh-completer-domain.h +++ b/tools/virsh-completer-domain.h @@ -110,3 +110,7 @@ char ** virshDomainLifecycleCompleter(vshControl *ctl, char ** virshDomainLifecycleActionCompleter(vshControl *ctl, const vshCmd *cmd, unsigned int flags); + +char ** virshCodesetNameCompleter(vshControl *ctl, + const vshCmd *cmd, + unsigned int flags); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 1c58c26d93..d40995f44d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -8791,6 +8791,7 @@ static const vshCmdOptDef opts_send_key[] =3D { {.name =3D "codeset", .type =3D VSH_OT_STRING, .flags =3D VSH_OFLAG_REQ_OPT, + .completer =3D virshCodesetNameCompleter, .help =3D N_("the codeset of keycodes, default:linux") }, {.name =3D "holdtime", --=20 2.29.2