Skip to content

Commit

Permalink
Improved Bash completions.
Browse files Browse the repository at this point in the history
  • Loading branch information
dreibh committed Oct 19, 2024
1 parent a91ac1c commit ed52717
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
13 changes: 12 additions & 1 deletion src/dbshell.bash-completion
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,18 @@ _dbshell()
{
# Based on: https://www.benningtons.net/index.php/bash-completion/
local cur prev words cword
_init_completion || return
if type -t _comp_initialize >/dev/null; then
_comp_initialize || return
elif type -t _init_completion >/dev/null; then
_init_completion || return
else
# Manual initialization for older bash completion versions:
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
words="${COMP_WORDS}"
cword="${COMP_CWORD}"
fi

# ====== Database configuration file =====================================
if [ "${cword}" -eq 1 ] ; then
Expand Down
13 changes: 12 additions & 1 deletion src/hipercontracer.bash-completion
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,18 @@ _hipercontracer()
{
# Based on: https://www.benningtons.net/index.php/bash-completion/
local cur prev words cword
_init_completion || return
if type -t _comp_initialize >/dev/null; then
_comp_initialize || return
elif type -t _init_completion >/dev/null; then
_init_completion || return
else
# Manual initialization for older bash completion versions:
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
words="${COMP_WORDS}"
cword="${COMP_CWORD}"
fi

case "${prev}" in
# ====== Generic value ===============================================
Expand Down
13 changes: 12 additions & 1 deletion src/udp-echo-server.bash-completion
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,18 @@ _udp_echo_server()
{
# Based on: https://www.benningtons.net/index.php/bash-completion/
local cur prev words cword
_init_completion || return
if type -t _comp_initialize >/dev/null; then
_comp_initialize || return
elif type -t _init_completion >/dev/null; then
_init_completion || return
else
# Manual initialization for older bash completion versions:
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
words="${COMP_WORDS}"
cword="${COMP_CWORD}"
fi

case "${prev}" in
# ====== Generic value ===============================================
Expand Down

0 comments on commit ed52717

Please sign in to comment.