Add autoenv command to manage autoenv's

usage: autoenv [-h] {init,edit,deinit}

options:
        -h, --help  show this help message and exit

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
This commit is contained in:
2018-04-25 20:04:00 +01:00
committed by Benie
parent 40c2395f43
commit 51f3f7fab4
3 changed files with 209 additions and 108 deletions

24
autoenv/_autoenv Normal file
View File

@@ -0,0 +1,24 @@
#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'
)
_describe -t commands command commands && ret=0 ;;
esac
return ret
}