Commit 3635aa19e8e624ad3336530184a49bef7b415b2d
1 parent
b29510ce70
Refactoring to prefer arrays over string hacks.
The position_args variable is now an array, instead of a string with argument names split by a space. This feels much cleaner.
Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff
antigen.zsh
... | ... | @@ -19,10 +19,11 @@ antigen-bundle () { |
19 | 19 | local btype=plugin |
20 | 20 | |
21 | 21 | # Set spec values based on the positional arguments. |
22 | - local position_args='url loc' | |
22 | + local position_args | |
23 | + position_args=(url loc) | |
23 | 24 | local i=1 |
24 | 25 | while ! [[ -z $1 || $1 == --*=* ]]; do |
25 | - local arg_name="$(echo "$position_args" | cut -d\ -f$i)" | |
26 | + local arg_name="${position_args[$i]}" | |
26 | 27 | local arg_value="$1" |
27 | 28 | eval "local $arg_name='$arg_value'" |
28 | 29 | shift |