expand string parameters with (g::) where appropriate
This commit is contained in:
parent
6e7ba25046
commit
85e9f4955b
2 changed files with 37 additions and 5 deletions
|
@ -30,6 +30,18 @@ function set_default() {
|
|||
fi
|
||||
}
|
||||
|
||||
function _p9k_g_expand() {
|
||||
local -a ts=("${=$(typeset -p $1)}")
|
||||
shift ts
|
||||
for x in "${ts[@]}"; do
|
||||
[[ $x == -* ]] || break
|
||||
# Don't change readonly variables. Ideally, we shouldn't modify any variables at all,
|
||||
# but for now this will do.
|
||||
[[ $x == -*r* ]] && return
|
||||
done
|
||||
typeset -g $1=${(g::)${(P)1}}
|
||||
}
|
||||
|
||||
# Converts large memory values into a human-readable unit (e.g., bytes --> GB)
|
||||
# Takes two arguments:
|
||||
# * $size - The number which should be prettified
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue