zsh/autoenv/_autoenv
Kenneth Benzie (Benie) 5a33d2b5ac Add autoenv add=local subcommand
The `add=local` subcommand creates `.local/bin` if it doesn't exit and
then updates the autoenv to add it to `PATH`.
2022-10-26 20:31:51 +01:00

28 lines
775 B
Plaintext

#compdef autoenv
# Completion for the autoenv command.
_autoenv() {
local ret=1 context curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C -w -s \
'(-h --help)'{-h,--help}'[show this help message and exit]' \
'1: :->command'
case $state in
(command)
declare -a commands
local commands=(
init:'add .enter and .exit scripts in current directory'
edit:'edit .enter and .exit scripts in current directory'
deinit:'remove .enter and .exit scripts in current directory'
reload:'reload the current environment'
add=local:'add .local/bin to PATH'
add=py:'add Python virtualenv to the autoenv'
)
_describe -t commands command commands && ret=0 ;;
esac
return ret
}