Add zsh completion support

Both bash and zsh completions could be supported using single file.
This commit is contained in:
Alexander Kapshuna
2020-09-12 18:08:31 +03:00
committed by borgmanJeremy
parent d72d1e6ad9
commit 23ae6c1579
3 changed files with 20 additions and 7 deletions

View File

@@ -17,7 +17,7 @@ Source0: https://github.com/flameshot-org/%{sourcename}/archive/v%{version}.tar.
%if 0%{?is_opensuse}
%if 0%{?suse_version} >= 1500
BuildRequires: gcc-c++ >= 4.9.2
BuildRequires: update-desktop-files
BuildRequires: update-desktop-files
%else
BuildRequires: gcc7
BuildRequires: gcc7-c++
@@ -25,8 +25,8 @@ BuildRequires: gcc7-c++
BuildRequires: libqt5-qttools-devel
BuildRequires: libqt5-linguist
%else
BuildRequires: gcc-c++ >= 4.9.2
%endif
BuildRequires: gcc-c++ >= 4.9.2
%endif
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
BuildRequires: qt5-qttools-devel
@@ -90,7 +90,8 @@ make %{?_smp_mflags}
%{_datadir}/metainfo/flameshot.metainfo.xml
%{_datadir}/flameshot/translations
%{_datadir}/applications/%{name}.desktop
%{_datadir}/bash-completions/completions/%{name}
%{_datadir}/bash-completion/completions/%{name}
%{_datadir}/zsh/site-functions/_%{name}
%{_datadir}/icons/hicolor
%changelog

View File

@@ -1,5 +1,8 @@
# bash-completion for flameshot command
#compdef flameshot
# Shell completion for flameshot command
# To be installed in "/usr/share/bash-completion/completions/flameshot"
# and "/usr/share/zsh/site-functions/"
_flameshot() {
local prev cur cmd gui_opts full_opts config_opts
@@ -64,4 +67,10 @@ _flameshot() {
;;
esac
}
if [[ -n ${ZSH_VERSION} ]]; then
autoload -U bashcompinit
bashcompinit
fi
complete -F _flameshot flameshot

View File

@@ -149,8 +149,11 @@ configure_file(${CMAKE_SOURCE_DIR}/docs/desktopEntry/package/flameshot.desktop
configure_file(${CMAKE_SOURCE_DIR}/docs/appdata/flameshot.metainfo.xml
${CMAKE_CURRENT_BINARY_DIR}/share/metainfo/flameshot.metainfo.xml COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/docs/bash-completion/flameshot
${CMAKE_CURRENT_BINARY_DIR}/share/bash-completions/completions/flameshot COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/docs/shell-completion/flameshot
${CMAKE_CURRENT_BINARY_DIR}/share/bash-completion/completions/flameshot COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/docs/shell-completion/flameshot
${CMAKE_CURRENT_BINARY_DIR}/share/zsh/site-functions/_flameshot COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/data/dbus/org.flameshot.Flameshot.xml
${CMAKE_CURRENT_BINARY_DIR}/share/dbus-1/interfaces/org.flameshot.Flameshot.xml COPYONLY)