diff options
-rwxr-xr-x | libreboot | 4 | ||||
-rwxr-xr-x | libs/project | 14 | ||||
-rwxr-xr-x | libs/tool | 14 |
3 files changed, 20 insertions, 12 deletions
@@ -26,7 +26,7 @@ libreboot_usage() { printf '\n%s\n' 'Generic project actions:' >&2 - for action in ${PROJECT_ACTIONS_GENERIC}; do + for action in "${PROJECT_ACTIONS_GENERIC[@]}"; do printf '%s\n' " ${action}" >&2 done @@ -46,7 +46,7 @@ libreboot_usage() { printf '\n%s\n' 'Generic tool actions:' >&2 - for action in ${TOOL_ACTIONS_GENERIC}; do + for action in "${TOOL_ACTIONS_GENERIC[@]}"; do printf '%s\n' " ${action}" >&2 done 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 @@ -15,16 +15,20 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -TOOL_ACTIONS_GENERIC="usage update execute" -TOOL_ACTIONS_HELPERS="arguments" -TOOL_FUNCTIONS=$( for action in $TOOL_ACTIONS_GENERIC ; do printf '%s\n' "$action" "$action""_check" ; done ; printf '%s\n' "$TOOL_ACTIONS_HELPERS" ) +TOOL_ACTIONS_GENERIC=(usage update execute) +TOOL_ACTIONS_HELPERS=(arguments) +TOOL_ACTIONS_FUNCTIONS=( + "${TOOL_ACTIONS_GENERIC[@]}" + "${TOOL_ACTIONS_GENERIC[@]/%/_check}" + "${TOOL_ACTIONS_HELPERS[@]}" +) tool_include() { local tool=$1 local tool_path=$( tool_path "$tool" ) - unset -f $TOOL_FUNCTIONS + unset -f "${TOOL_ACTIONS_FUNCTIONS[@]}" . "$tool_path/$tool" @@ -236,7 +240,7 @@ tool_usage_actions() { printf '\n%s\n' 'Generic actions:' - for action in $TOOL_ACTIONS_GENERIC + for action in "${TOOL_ACTIONS_GENERIC[@]}" do if function_check "$action" then |