mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
tools: Generate per-command bash completion script
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 <abologna@redhat.com> Reviewed-by: Neal Gompa <ngompa13@gmail.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
c813acc0df
commit
cf66ee8ddc
@ -1909,9 +1909,6 @@ exit 0
|
|||||||
|
|
||||||
%{_datadir}/libvirt/test-screenshot.png
|
%{_datadir}/libvirt/test-screenshot.png
|
||||||
|
|
||||||
%files bash-completion
|
|
||||||
%{_datadir}/bash-completion/completions/vsh
|
|
||||||
|
|
||||||
%if %{with_wireshark}
|
%if %{with_wireshark}
|
||||||
%files wireshark
|
%files wireshark
|
||||||
%{wireshark_plugindir}/libvirt.so
|
%{wireshark_plugindir}/libvirt.so
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
install_data('vsh', install_dir: bash_completion_dir)
|
completion_commands = [
|
||||||
|
'virsh',
|
||||||
|
'virt-admin',
|
||||||
|
]
|
||||||
|
|
||||||
meson.add_install_script(
|
foreach command : completion_commands
|
||||||
meson_python_prog.path(), python3_prog.path(), meson_install_symlink_prog.path(),
|
completion_conf = configuration_data()
|
||||||
bash_completion_dir, 'vsh', 'virsh',
|
completion_conf.set('command', command)
|
||||||
)
|
completion = configure_file(
|
||||||
|
input: 'vsh.in',
|
||||||
meson.add_install_script(
|
output: command,
|
||||||
meson_python_prog.path(), python3_prog.path(), meson_install_symlink_prog.path(),
|
configuration: completion_conf,
|
||||||
bash_completion_dir, 'vsh', 'virt-admin',
|
)
|
||||||
)
|
install_data(completion, install_dir: bash_completion_dir)
|
||||||
|
endforeach
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#
|
#
|
||||||
# virsh & virt-admin completion command
|
# @command@ completion support
|
||||||
#
|
#
|
||||||
|
|
||||||
_vsh_complete()
|
_@command@_complete()
|
||||||
{
|
{
|
||||||
local words cword c=0 i=0 cur RO URI CMDLINE INPUT A
|
local words cword c=0 i=0 cur RO URI CMDLINE INPUT A
|
||||||
|
|
||||||
@ -62,7 +62,6 @@ _vsh_complete()
|
|||||||
__ltrim_colon_completions "$cur"
|
__ltrim_colon_completions "$cur"
|
||||||
return 0
|
return 0
|
||||||
} &&
|
} &&
|
||||||
complete -o default -o filenames -F _vsh_complete virsh &&
|
complete -o default -o filenames -F _@command@_complete @command@
|
||||||
complete -o default -o filenames -F _vsh_complete virt-admin
|
|
||||||
|
|
||||||
# vim: ft=sh:et:ts=4:sw=4:tw=80
|
# vim: ft=sh:et:ts=4:sw=4:tw=80
|
Loading…
Reference in New Issue
Block a user