mirror of
https://github.com/dlang-community/DCD.git
synced 2025-04-25 12:49:55 +03:00
Add bash completion support. Fix #283
This commit is contained in:
parent
82ecc2d27a
commit
35e24667f0
3 changed files with 62 additions and 2 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -5,8 +5,8 @@
|
|||
*.dll
|
||||
|
||||
# *nix binaries
|
||||
dcd-client
|
||||
dcd-server
|
||||
bin/dcd-client
|
||||
bin/dcd-server
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
|
28
bash-completion/completions/dcd-client
Normal file
28
bash-completion/completions/dcd-client
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Completion for dcd-client
|
||||
_dcd_client()
|
||||
{
|
||||
local cur prev opts
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
opts="--help -h --cursorPos -c --shutdown --symbolLocation -l --doc -d\
|
||||
--search -s --query -q --status -I --version --port -p --tcp --socketFile"
|
||||
if [[ ${cur} == -* ]]; then
|
||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||
return 0;
|
||||
fi
|
||||
case "${prev}" in
|
||||
"-I")
|
||||
COMPREPLY=($(compgen -d ${cur}))
|
||||
return 0
|
||||
;;
|
||||
"--socketFile")
|
||||
COMPREPLY=($(compgen -f ${cur}))
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||
}
|
||||
complete -F _dcd_client "dcd-client"
|
32
bash-completion/completions/dcd-server
Executable file
32
bash-completion/completions/dcd-server
Executable file
|
@ -0,0 +1,32 @@
|
|||
# Completion for dcd-server
|
||||
_dcd_server()
|
||||
{
|
||||
local cur prev opts
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
opts="-I --help -h --version --logLevel --tcp --socketFile"
|
||||
logLevels="all trace info warning error critical fatal off"
|
||||
if [[ ${cur} == -* ]]; then
|
||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||
return 0;
|
||||
fi
|
||||
case "${prev}" in
|
||||
"-I")
|
||||
COMPREPLY=($(compgen -d ${cur}))
|
||||
return 0
|
||||
;;
|
||||
"--logLevel")
|
||||
COMPREPLY=($(compgen -W "${logLevels}" -- ${cur}))
|
||||
return 0
|
||||
;;
|
||||
"--socketFile")
|
||||
COMPREPLY=($(compgen -f ${cur}))
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||
}
|
||||
complete -F _dcd_server "dcd-server"
|
Loading…
Add table
Add a link
Reference in a new issue