diff --git a/CMakeLists.txt b/CMakeLists.txt index 7675062..9817eed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,10 @@ if (UNIX AND NOT MINGW) if (NOT DEFINED CPACK_GENERATOR) set(CPACK_GENERATOR TGZ;STGZ;RPM;DEB) endif() - install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/bash-completion.sh ${CMAKE_CURRENT_SOURCE_DIR}/scripts/fish-completion.fish + install(FILES + ${CMAKE_CURRENT_SOURCE_DIR}/scripts/bash-completion.sh + ${CMAKE_CURRENT_SOURCE_DIR}/scripts/fish-completion.fish + ${CMAKE_CURRENT_SOURCE_DIR}/scripts/zsh-completion.zsh DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/ybcon.d) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ybcon ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ybcon.sh PERMISSIONS diff --git a/scripts/postinst.sh b/scripts/postinst.sh index cb8d61c..ee2ec82 100644 --- a/scripts/postinst.sh +++ b/scripts/postinst.sh @@ -7,6 +7,7 @@ ln -sf /opt/bin/ybcon.sh /usr/bin/ybcon ybconDir="/opt/etc/ybcon.d" fishLoc="/usr/share/fish/vendor_completions.d" bashcompleteLoc="/etc/bash_completion.d" +zshLoc="/etc/zsh_completion.d" if [ -d $bashcompleteLoc ]; then ln -sf "$ybconDir/bash-completion.sh" "$bashcompleteLoc/ybcon.sh" fi @@ -16,4 +17,11 @@ if [ -f "/usr/bin/fish" ]; then mkdir "$fishLoc" fi ln -sf "$ybconDir/fish-completion.fish" "$fishLoc/ybcon.fish" +fi + +zshBin="/usr/bin/zsh" +if [ -f $zshBin ]; then + if [ -d $zshLoc ]; then + ln -sf "$ybconDir/zsh-completion.zsh" "$zshLoc/_ybcon" + fi fi \ No newline at end of file diff --git a/scripts/zsh-completion.zsh b/scripts/zsh-completion.zsh new file mode 100644 index 0000000..0ccd194 --- /dev/null +++ b/scripts/zsh-completion.zsh @@ -0,0 +1,7 @@ +#compdef ybcon +_ybcon() { + _arguments '-h[Print the help screen]' '--help[Print the help screen]' '--version[Print the version]' '-p[input file]:filename:_path_files -/ -g "*.ybcon"' + return 0 +} + +_ybcon \ No newline at end of file