mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-22 05:55:38 +00:00
RESET_COMPONENT: migrated to features.json
This commit is contained in:
parent
1fc1e4fe1a
commit
d6f1fa3a3f
30
retrodeck.sh
30
retrodeck.sh
|
@ -2,6 +2,16 @@
|
||||||
|
|
||||||
source /app/libexec/global.sh
|
source /app/libexec/global.sh
|
||||||
|
|
||||||
|
# uses jq to extract all the emulators (components) that don't have resettable: false in the features.json and separate them with "|"
|
||||||
|
resettable_components=$(jq -r '
|
||||||
|
[(.emulator | to_entries[]) |
|
||||||
|
select(.value.core == null and .value.resettable != false) |
|
||||||
|
.key] | sort | join("|")
|
||||||
|
' "$features")
|
||||||
|
|
||||||
|
# uses sed to create, a, list, like, this
|
||||||
|
pretty_resettable_components=$(echo "$resettable_components" | sed 's/|/, /g')
|
||||||
|
|
||||||
# Arguments section
|
# Arguments section
|
||||||
|
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
|
@ -55,19 +65,15 @@ https://retrodeck.net
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
--reset-component*)
|
--reset-component*)
|
||||||
echo "You are about to reset one or more RetroDECK components or emulators."
|
component="$2"
|
||||||
echo "Available options are: es-de, retroarch, cemu, dolphin, duckstation, gzdoom, melonds, pcsx3, pico8, ppsspp, primehack, rpcs3, ryujinx, xemu, vita3k, mame, all"
|
if [ -z "$component" ]; then
|
||||||
read -p "Please enter the component you would like to reset: " component
|
echo "You are about to reset one or more RetroDECK components or emulators."
|
||||||
component=$(echo "$component" | tr '[:upper:]' '[:lower:]')
|
echo -e "Available options are:\nall, $pretty_resettable_components"
|
||||||
|
read -p "Please enter the component you would like to reset: " component
|
||||||
|
component=$(echo "$component" | tr '[:upper:]' '[:lower:]')
|
||||||
|
fi
|
||||||
|
|
||||||
# TODO: this is the jq to get all the resettable emulators list, generic component is missing
|
if [[ "$component" =~ ^(all|$resettable_components)$ ]]; then
|
||||||
# jq -r '
|
|
||||||
# [(.emulator | to_entries[]) |
|
|
||||||
# select(.value.core == null and .value.resettable != false) |
|
|
||||||
# .key] | sort | join("|")
|
|
||||||
# ' "$features"
|
|
||||||
|
|
||||||
if [[ "$component" =~ ^(es-de|retroarch|cemu|dolphin|duckstation|gzdoom|mame|melonds|pcsx2|ppsspp|primehack|ryujinx|rpcs3|vita3k|xemu|all)$ ]]; then
|
|
||||||
read -p "You are about to reset $component to default settings. Enter 'y' to continue, 'n' to stop: " response
|
read -p "You are about to reset $component to default settings. Enter 'y' to continue, 'n' to stop: " response
|
||||||
if [[ $response == [yY] ]]; then
|
if [[ $response == [yY] ]]; then
|
||||||
prepare_component "reset" "$component" "cli"
|
prepare_component "reset" "$component" "cli"
|
||||||
|
|
Loading…
Reference in a new issue