2c06852546f52330c389b53a1b81348e62f64423

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

style(dirhistory): remove use of `eval` completely

Diff

 1diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh
 2index e3f45ee993ca00579a94acbd69e5c1be97f21ca3..9f39264cfcb58712858cdaab5aa586f6e3923851 100644
 3--- a/plugins/dirhistory/dirhistory.plugin.zsh
 4+++ b/plugins/dirhistory/dirhistory.plugin.zsh
 5@@ -19,14 +19,14 @@ export DIRHISTORY_SIZE=30
 6 # Returns the element if the array was not empty,
 7 # otherwise returns empty string.
 8 function pop_past() {
 9-  eval "$1=${(q)dirhistory_past[$#dirhistory_past]}"
10+  print -v $1 "${dirhistory_past[$#dirhistory_past]}"
11   if [[ $#dirhistory_past -gt 0 ]]; then
12     dirhistory_past[$#dirhistory_past]=()
13   fi
14 }
15 
16 function pop_future() {
17-  eval "$1=${(q)dirhistory_future[$#dirhistory_future]}"
18+  print -v $1 "${dirhistory_future[$#dirhistory_future]}"
19   if [[ $#dirhistory_future -gt 0 ]]; then
20     dirhistory_future[$#dirhistory_future]=()
21   fi