Skip to content
Permalink
Browse files

add bash_completion script for psi-server

  • Loading branch information
snukky committed Jun 26, 2013
1 parent d08303c commit 8fa2c6c63e7732370c9c7e4dc3cd5197e3f3aa51
Showing with 29 additions and 0 deletions.
  1. +3 −0 CMakeLists.txt
  2. +26 −0 psi-server
@@ -98,7 +98,10 @@ configure_file(
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)

# Install bash-completion scripts

install(FILES psi-pipe DESTINATION /etc/bash_completion.d)
install(FILES psi-server DESTINATION /etc/bash_completion.d)

# ====================================================
# Finds and includes external libraries
@@ -0,0 +1,26 @@
_psi-server()
{
local cur prev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"

if [[ ${cur} == -* ]] ; then
local opts=$( psi-server --help 2> /dev/null | grep -oP '(?=(\[| )) --[a-z\-]+')
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi

case "${prev}" in
--log-level)
local levels="TRACE DEBUG INFO WARN ERROR FATAL"
COMPREPLY=( $(compgen -W "${levels}" -- ${cur}) )
return 0
;;
*)
;;
esac

_filedir
}
complete -F _psi-server psi-server

0 comments on commit 8fa2c6c

Please sign in to comment.
You can’t perform that action at this time.