mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Keep useful comments...
We still use eval, comment about its usage is still relevant...
This commit is contained in:
parent
84c66990c3
commit
8b8df94bef
1 changed files with 9 additions and 0 deletions
|
@ -153,6 +153,13 @@ ynh_handle_getopts_args () {
|
|||
eval ${option_var}+="\;"
|
||||
fi
|
||||
|
||||
# For the record.
|
||||
# We're using eval here to get the content of the variable stored itself as simple text in $option_var...
|
||||
# Other ways to get that content would be to use either ${!option_var} or declare -g ${option_var}
|
||||
# But... ${!option_var} can't be used as left part of an assignation.
|
||||
# declare -g ${option_var} will create a local variable (despite -g !) and will not be available for the helper itself.
|
||||
# So... Stop fucking arguing each time that eval is evil... Go find an other working solution if you can find one!
|
||||
|
||||
eval ${option_var}+='"${all_args[$i]}"'
|
||||
shift_value=$(( shift_value + 1 ))
|
||||
fi
|
||||
|
@ -191,6 +198,8 @@ ynh_handle_getopts_args () {
|
|||
# The variable name will be stored in 'option_var'
|
||||
local option_var="${args_array[$option_flag]%=}"
|
||||
|
||||
# Store each value given as argument in the corresponding variable
|
||||
# The values will be stored in the same order than $args_array
|
||||
eval ${option_var}+='"${arguments[$i]}"'
|
||||
done
|
||||
unset legacy_args
|
||||
|
|
Loading…
Add table
Reference in a new issue