dev-env/bin/denv
2025-05-25 22:21:05 +02:00

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