mirror of
https://github.com/Tarrasch/zsh-autoenv.git
synced 2024-11-21 23:10:59 +02:00
commit
435f54761b
12
lib/varstash
12
lib/varstash
@ -34,7 +34,7 @@
|
||||
# autostash PATH
|
||||
# export PATH=/something/else
|
||||
#
|
||||
# You may also do both operations on line line, leaving only the very succinct
|
||||
# You may also do both operations in one line, resulting in the very succinct
|
||||
#
|
||||
# autostash PATH=/something/else
|
||||
#
|
||||
@ -55,7 +55,6 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
|
||||
function stash() {
|
||||
if [[ $1 == "-f" ]]; then
|
||||
local force=1; shift
|
||||
@ -135,18 +134,13 @@ function stash() {
|
||||
# Handle any variable that may exist under this name
|
||||
local vartype="$(declare -p $stash_which 2>/dev/null)"
|
||||
if [[ -n $vartype ]]; then
|
||||
if [[ -n $ZSH_VERSION ]]; then
|
||||
local pattern="typeset"
|
||||
else
|
||||
local pattern="declare"
|
||||
fi
|
||||
if [[ $vartype == $pattern" -a"* ]]; then
|
||||
if [[ $vartype == 'typeset -a'* ]]; then
|
||||
# varible is an array
|
||||
if [[ -z $already_stashed ]]; then
|
||||
eval "__varstash_array__$stash_name=(\"\${$stash_which""[@]}\")"
|
||||
fi
|
||||
|
||||
elif [[ $vartype == $pattern" -x"* ]]; then
|
||||
elif [[ $vartype == "export "* || $vartype == 'typeset -x'* ]]; then
|
||||
# variable is exported
|
||||
if [[ -z $already_stashed ]]; then
|
||||
eval "export __varstash_export__$stash_name=\"\$$stash_which\""
|
||||
|
Loading…
Reference in New Issue
Block a user