From nobody Mon Feb 9 23:42:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618938859; cv=none; d=zohomail.com; s=zohoarc; b=fITeUkIySfVs1N+qd0siMSiZ/02DwJqr8wK89RcGz4N1ufDgzXsvVXoEO6NXsi+FXrvXYO1XNxeR1Zv7wTptz3T05hrGNpDYVklZzyhZ0z1umEFp16HOQ0IeBd+dx3WSqstxCqxEZd8gwSNA0pQx6GZT3I+sVLzSRYsKYlFtHQY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618938859; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1mamxb8tXOkBc+PVCZsRJ1Mn6ICm5DsfheYmzMqQgRs=; b=PUYZPnkQtnRhvzrk+NO0fGb4BbqIhsOGl9BweK+eUoodN2i72PFfdfDqvm3+99VfxMg/osOzmDN1/K0LQU7bZjZftr6NbjS1Gpru1QkPYuXBDG4hiUA/6N3Dg8jNqg3gP9oNEgLn0GW7XQrAMhnDM3frzH9clD+ZlMTNKjHLLqU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 16189388591911007.9236429487485; Tue, 20 Apr 2021 10:14:19 -0700 (PDT) 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-443-IwwDwr0PMJGGqOd690sfWw-1; Tue, 20 Apr 2021 13:14:05 -0400 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 18359CC658; Tue, 20 Apr 2021 17:13:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EBFDB5C1A1; Tue, 20 Apr 2021 17:13:50 +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 B64D744A62; Tue, 20 Apr 2021 17:13:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13KHDdWJ023455 for ; Tue, 20 Apr 2021 13:13:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8DDAD50FAF; Tue, 20 Apr 2021 17:13:39 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.195.191]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A606D50F89 for ; Tue, 20 Apr 2021 17:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618938858; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=1mamxb8tXOkBc+PVCZsRJ1Mn6ICm5DsfheYmzMqQgRs=; b=jTK/oYZzQM/np5TIA/0I8WQGLp3hMzC/8AtfrsyD/9k50CFgr4U3BbrwvEyECZ/ABhqWpe //515x85wba7bTa0h3vYVNI1P1Ud2nNHdbEADj+ZHnOvSKpWfOpsbTskah8kHk/NtA+ai8 x030kaoJ6kpGDFxHy+DQ7lGUN4ieKag= X-MC-Unique: IwwDwr0PMJGGqOd690sfWw-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v4 6/7] tools: Generate per-command bash completion script Date: Tue, 20 Apr 2021 19:13:21 +0200 Message-Id: <20210420171322.544322-7-abologna@redhat.com> In-Reply-To: <20210420171322.544322-1-abologna@redhat.com> References: <20210420171322.544322-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@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@redhat.com Errors-To: libvir-list-bounces@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@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The current setup uses a single script that is symlinked twice and that tries to configure bash completion for both virsh and virt-admin, even if only one of them is installed. This also forces us to have a -bash-completion RPM package that only contains the tiny shared file. Rework bash completion support so that two scripts are generated, each one tailored to a specific command. Since the shared script no longer exists after this change, the corresponding RPM package becomes empty. Signed-off-by: Andrea Bolognani --- libvirt.spec.in | 3 --- tools/bash-completion/meson.build | 24 ++++++++++++++---------- tools/bash-completion/{vsh =3D> vsh.in} | 7 +++---- 3 files changed, 17 insertions(+), 17 deletions(-) rename tools/bash-completion/{vsh =3D> vsh.in} (91%) diff --git a/libvirt.spec.in b/libvirt.spec.in index 6d2206633f..76af267681 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1905,9 +1905,6 @@ exit 0 =20 %{_datadir}/libvirt/test-screenshot.png =20 -%files bash-completion -%{_datadir}/bash-completion/completions/vsh - %if %{with_wireshark} %files wireshark %{wireshark_plugindir}/libvirt.so diff --git a/tools/bash-completion/meson.build b/tools/bash-completion/meso= n.build index 8924c93adf..deda7c4f46 100644 --- a/tools/bash-completion/meson.build +++ b/tools/bash-completion/meson.build @@ -1,11 +1,15 @@ -install_data('vsh', install_dir: bash_completion_dir) +completion_commands =3D [ + 'virsh', + 'virt-admin', +] =20 -meson.add_install_script( - meson_python_prog.path(), python3_prog.path(), meson_install_symlink_pro= g.path(), - bash_completion_dir, 'vsh', 'virsh', -) - -meson.add_install_script( - meson_python_prog.path(), python3_prog.path(), meson_install_symlink_pro= g.path(), - bash_completion_dir, 'vsh', 'virt-admin', -) +foreach command : completion_commands + completion_conf =3D configuration_data() + completion_conf.set('command', command) + completion =3D configure_file( + input: 'vsh.in', + output: command, + configuration: completion_conf, + ) + install_data(completion, install_dir: bash_completion_dir) +endforeach diff --git a/tools/bash-completion/vsh b/tools/bash-completion/vsh.in similarity index 91% rename from tools/bash-completion/vsh rename to tools/bash-completion/vsh.in index bbb25fc3eb..8dde38474f 100644 --- a/tools/bash-completion/vsh +++ b/tools/bash-completion/vsh.in @@ -1,8 +1,8 @@ # -# virsh & virt-admin completion command +# @command@ completion support # =20 -_vsh_complete() +_@command@_complete() { local words cword c=3D0 i=3D0 cur RO URI CMDLINE INPUT A =20 @@ -62,7 +62,6 @@ _vsh_complete() __ltrim_colon_completions "$cur" return 0 } && -complete -o default -o filenames -F _vsh_complete virsh && -complete -o default -o filenames -F _vsh_complete virt-admin +complete -o default -o filenames -F _@command@_complete @command@ =20 # vim: ft=3Dsh:et:ts=3D4:sw=3D4:tw=3D80 --=20 2.26.3