Add basic (and incomplete) zsh completions with scripts/zsh-completion.zsh.

This commit is contained in:
Username404-59 2021-02-27 22:17:03 +01:00
parent 41dedff221
commit 85dc6d7675
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
3 changed files with 19 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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