mirror of
https://github.com/Tarrasch/zsh-autoenv.git
synced 2024-12-01 18:31:00 +02:00
Do not reset the stack variables when (re)sourcing the plugin
This is meant to keep the current state when re-sourcing the shell config (`. ~/.zshrc`).
This commit is contained in:
parent
15bc1e3c62
commit
0caf2c1bb5
@ -41,10 +41,8 @@ autoenv_source_parent() {
|
|||||||
# Internal functions. {{{
|
# Internal functions. {{{
|
||||||
# Internal: stack of entered (and handled) directories. {{{
|
# Internal: stack of entered (and handled) directories. {{{
|
||||||
typeset -g -a _autoenv_stack_entered
|
typeset -g -a _autoenv_stack_entered
|
||||||
_autoenv_stack_entered=()
|
|
||||||
# -g: make it global, this is required when used with antigen.
|
# -g: make it global, this is required when used with antigen.
|
||||||
typeset -g -A _autoenv_stack_entered_mtime
|
typeset -g -A _autoenv_stack_entered_mtime
|
||||||
_autoenv_stack_entered_mtime=()
|
|
||||||
|
|
||||||
# Add an entry to the stack, and remember its mtime.
|
# Add an entry to the stack, and remember its mtime.
|
||||||
_autoenv_stack_entered_add() {
|
_autoenv_stack_entered_add() {
|
||||||
|
@ -2,7 +2,6 @@ test -f "$TESTDIR/.zcompdump" && rm "$TESTDIR/.zcompdump"
|
|||||||
|
|
||||||
AUTOENV_DEBUG=0
|
AUTOENV_DEBUG=0
|
||||||
|
|
||||||
source "$TESTDIR/../autoenv.plugin.zsh"
|
|
||||||
export AUTOENV_ENV_FILENAME="$PWD/.env_auth"
|
export AUTOENV_ENV_FILENAME="$PWD/.env_auth"
|
||||||
|
|
||||||
echo -n > $AUTOENV_ENV_FILENAME
|
echo -n > $AUTOENV_ENV_FILENAME
|
||||||
|
@ -74,6 +74,7 @@ Now, will it take no for an answer?
|
|||||||
|
|
||||||
Lets also try one more time to ensure it didn't add it.
|
Lets also try one more time to ensure it didn't add it.
|
||||||
|
|
||||||
|
$ _autoenv_ask_for_yes() { echo "yes"; return 0 }
|
||||||
$ cd .
|
$ cd .
|
||||||
Attempting to load unauthorized env file!
|
Attempting to load unauthorized env file!
|
||||||
-* /tmp/cramtests-*/autoenv.t/.env (glob)
|
-* /tmp/cramtests-*/autoenv.t/.env (glob)
|
||||||
@ -84,4 +85,11 @@ Lets also try one more time to ensure it didn't add it.
|
|||||||
|
|
||||||
**********************************************
|
**********************************************
|
||||||
|
|
||||||
Would you like to authorize it? (type 'yes') no
|
Would you like to authorize it? (type 'yes') yes
|
||||||
|
ENTERED
|
||||||
|
|
||||||
|
Reloading the script should keep the current state, e.g. when reloading your
|
||||||
|
~/.zshrc.
|
||||||
|
|
||||||
|
$ source $TEST_AUTOENV_PLUGIN_FILE
|
||||||
|
$ cd .
|
||||||
|
@ -14,6 +14,9 @@ if [[ $AUTOENV_ENV_FILENAME[0,4] != '/tmp' ]]; then
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
TEST_AUTOENV_PLUGIN_FILE="$TESTDIR/../autoenv.plugin.zsh"
|
||||||
|
source $TEST_AUTOENV_PLUGIN_FILE
|
||||||
|
|
||||||
# Reset any authentication.
|
# Reset any authentication.
|
||||||
echo -n >| $AUTOENV_ENV_FILENAME
|
echo -n >| $AUTOENV_ENV_FILENAME
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user