diff --git a/autoenv/_autoenv b/autoenv/_autoenv index 1323154..d852e02 100644 --- a/autoenv/_autoenv +++ b/autoenv/_autoenv @@ -16,6 +16,7 @@ _autoenv() { 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=py:'add Python virtualenv to the autoenv' ) _describe -t commands command commands && ret=0 ;; diff --git a/autoenv/autoenv.zsh b/autoenv/autoenv.zsh index 20337c5..1d24118 100644 --- a/autoenv/autoenv.zsh +++ b/autoenv/autoenv.zsh @@ -12,7 +12,7 @@ autoenv() { case "$cmd" in -h|--help) # Display help. echo "\ -usage: autoenv [-h] {init,edit,deinit} +usage: autoenv [-h] {init,edit,deinit,reload,add=py} options: -h, --help show this help message and exit @@ -21,6 +21,7 @@ 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=py add Python virtualenv to the autoenv" ;; @@ -81,6 +82,16 @@ commands: done ;; + reload) # Reload the current environment + if ! [ -f $PWD/.enter ] || ! [ -f $PWD/.exit ]; then + echo '.enter or .exit not found'; return 1 + fi + # Exit the autoenv before editing. + _autoenv_exit $PWD + # Enter the autoenv. + _autoenv_enter $PWD + ;; + add=py) # Add Python virtualenv to the sandbox if ! [ -f $PWD/.enter ] || ! [ -f $PWD/.exit ]; then echo '.enter or .exit not found'; return 1