diff options
author | Andrew Robbins <contact@andrewrobbins.info> | 2017-07-12 12:32:14 -0400 |
---|---|---|
committer | Andrew Robbins <contact@andrewrobbins.info> | 2017-07-14 15:16:05 -0400 |
commit | 547be866932ec92ca818a7ed661519dd9be598d5 (patch) | |
tree | 646cb7412cd51cdfe6da65a6d6deeb49df97f298 /libs/project | |
parent | 8c7d21cbf45a4279dcffae95ce626a0dc9006a30 (diff) | |
download | librebootfr-547be866932ec92ca818a7ed661519dd9be598d5.tar.gz librebootfr-547be866932ec92ca818a7ed661519dd9be598d5.zip |
Rely less on word splitting by using arrays
Arrays are just a better idea for storing multiple strings than relying
on word splitting. Consequently, several global variables in libs/*
were switched to arrays and any references to said variables modified
to expand to the arrays' elements.
Diffstat (limited to 'libs/project')
-rwxr-xr-x | libs/project | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libs/project b/libs/project index d2779224..0f30ace3 100755 --- a/libs/project +++ b/libs/project @@ -15,9 +15,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -PROJECT_ACTIONS_GENERIC="usage download extract update build install release clean" -PROJECT_ACTIONS_HELPERS="arguments" -PROJECT_FUNCTIONS=$( for action in $PROJECT_ACTIONS_GENERIC ; do printf '%s\n' "$action" "$action""_check" ; done ; printf '%s\n' "$PROJECT_ACTIONS_HELPERS" ) +PROJECT_ACTIONS_GENERIC=(usage download extract update build install release clean) +PROJECT_ACTIONS_HELPERS=(arguments) +PROJECT_ACTIONS_FUNCTIONS=( + "${PROJECT_ACTIONS_GENERIC[@]}" + "${PROJECT_ACTIONS_GENERIC[@]/%/_check}" + "${PROJECT_ACTIONS_HELPERS[@]}" +) INSTALL_REGEX="\([^:]*\):\(.*\)" @@ -26,7 +30,7 @@ project_include() { local project_path=$( project_path "$project" ) - unset -f $PROJECT_FUNCTIONS + unset -f "${PROJECT_ACTIONS_FUNCTIONS[@]}" . "$project_path/$project" @@ -562,7 +566,7 @@ project_usage_actions() { printf '\n%s\n' 'Generic actions:' ( - for action in ${PROJECT_ACTIONS_GENERIC}; do + for action in "${PROJECT_ACTIONS_GENERIC[@]}"; do if function_check "${action}"; then printf '%s\n' " ${action}" fi |