%{_datadir}/libvirt/test-screenshot.png
-%files bash-completion
-%{_datadir}/bash-completion/completions/vsh
-
%if %{with_wireshark}
%files wireshark
%{wireshark_plugindir}/libvirt.so
-install_data('vsh', install_dir: bash_completion_dir)
+completion_commands = [
+ 'virsh',
+ 'virt-admin',
+]
-meson.add_install_script(
- meson_python_prog.path(), python3_prog.path(), meson_install_symlink_prog.path(),
- bash_completion_dir, 'vsh', 'virsh',
-)
-
-meson.add_install_script(
- meson_python_prog.path(), python3_prog.path(), meson_install_symlink_prog.path(),
- bash_completion_dir, 'vsh', 'virt-admin',
-)
+foreach command : completion_commands
+ completion_conf = configuration_data()
+ completion_conf.set('command', command)
+ completion = configure_file(
+ input: 'vsh.in',
+ output: command,
+ configuration: completion_conf,
+ )
+ install_data(completion, install_dir: bash_completion_dir)
+endforeach
#
-# 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
__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@
# vim: ft=sh:et:ts=4:sw=4:tw=80