Add autoenv reload subcommand

The `autoenv reload` subcommand reloads the current environment.
This commit is contained in:
Kenneth Benzie 2021-02-09 16:45:52 +00:00
parent 0b5fc5ad97
commit 83c37fbf3f
2 changed files with 12 additions and 0 deletions

View File

@ -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 ;;

View File

@ -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