24 lines
496 B
Bash
24 lines
496 B
Bash
#!/bin/bash
|
|
ENV_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/../" &> /dev/null && pwd )
|
|
|
|
function denv() {
|
|
if [ ! -z $1 ] ; then
|
|
$ENV_DIR/$1
|
|
else
|
|
cd $ENV_DIR
|
|
fi
|
|
}
|
|
|
|
_denv_completion() {
|
|
local cur prev opts
|
|
COMPREPLY=()
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
|
|
opts=$(find "$ENV_DIR" -maxdepth 1 -type f -executable -printf "%f\n")
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
return 0
|
|
}
|
|
|
|
complete -F _denv_completion denv |