Add basic (and incomplete) zsh completions with scripts/zsh-completion.zsh.
This commit is contained in:
parent
41dedff221
commit
85dc6d7675
|
@ -63,7 +63,10 @@ if (UNIX AND NOT MINGW)
|
||||||
if (NOT DEFINED CPACK_GENERATOR)
|
if (NOT DEFINED CPACK_GENERATOR)
|
||||||
set(CPACK_GENERATOR TGZ;STGZ;RPM;DEB)
|
set(CPACK_GENERATOR TGZ;STGZ;RPM;DEB)
|
||||||
endif()
|
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)
|
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/ybcon.d)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ybcon ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ybcon.sh
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ybcon ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ybcon.sh
|
||||||
PERMISSIONS
|
PERMISSIONS
|
||||||
|
|
|
@ -7,6 +7,7 @@ ln -sf /opt/bin/ybcon.sh /usr/bin/ybcon
|
||||||
ybconDir="/opt/etc/ybcon.d"
|
ybconDir="/opt/etc/ybcon.d"
|
||||||
fishLoc="/usr/share/fish/vendor_completions.d"
|
fishLoc="/usr/share/fish/vendor_completions.d"
|
||||||
bashcompleteLoc="/etc/bash_completion.d"
|
bashcompleteLoc="/etc/bash_completion.d"
|
||||||
|
zshLoc="/etc/zsh_completion.d"
|
||||||
if [ -d $bashcompleteLoc ]; then
|
if [ -d $bashcompleteLoc ]; then
|
||||||
ln -sf "$ybconDir/bash-completion.sh" "$bashcompleteLoc/ybcon.sh"
|
ln -sf "$ybconDir/bash-completion.sh" "$bashcompleteLoc/ybcon.sh"
|
||||||
fi
|
fi
|
||||||
|
@ -16,4 +17,11 @@ if [ -f "/usr/bin/fish" ]; then
|
||||||
mkdir "$fishLoc"
|
mkdir "$fishLoc"
|
||||||
fi
|
fi
|
||||||
ln -sf "$ybconDir/fish-completion.fish" "$fishLoc/ybcon.fish"
|
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
|
fi
|
|
@ -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
|
Loading…
Reference in New Issue