mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-30 01:25:55 +00:00
30d87168e7
Changes to be committed: new file: configurator/scripts/class_functions.gd modified: retrodeck_function_wrapper.sh
26 lines
635 B
Bash
Executable file
26 lines
635 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# This wrapper will run a single RetroDECK function with any number of arguments
|
|
# USAGE: /bin/bash retrodeck_function_wrapper.sh <function_name> <arg1> <arg2> ...
|
|
|
|
source /app/libexec/global.sh
|
|
|
|
# Check if a function was specified
|
|
if [[ $# -lt 1 ]]; then
|
|
log e "Usage: $0 function_name [args...]"
|
|
exit 1
|
|
fi
|
|
|
|
# Get the function name and remove it from the list of arguments
|
|
function_name="$1"
|
|
shift
|
|
|
|
# Check if the function exists
|
|
if ! declare -f "$function_name" >/dev/null 2>&1; then
|
|
log e "Function \'$function_name\' not found"
|
|
exit 1
|
|
fi
|
|
|
|
# Call the function with any remaining arguments
|
|
"$function_name" "$@"
|