-r added for game removal.
This commit is contained in:
parent
5bc1dbba9d
commit
c085855202
@ -278,6 +278,43 @@ game_installer() {
|
||||
--menu "Please select a game to install" 0 0 0 "${menuList[@]}" --stdout)"
|
||||
}
|
||||
|
||||
|
||||
# remove games
|
||||
game_removal() {
|
||||
mapfile -t lines < <(sed '/^$/d' "${configFile}" 2> /dev/null)
|
||||
if [[ ${#lines} -eq 0 ]]; then
|
||||
echo "No games found."
|
||||
exit 0
|
||||
fi
|
||||
# Create the menu of installed games
|
||||
declare -a menuList
|
||||
for i in "${lines[@]}" ; do
|
||||
menuList+=("${i#*|}" "${i%|*}")
|
||||
done
|
||||
menuList+=("Donate" "Donate")
|
||||
menuList+=("Become a Patron" "Become a Patron")
|
||||
local game="$(dialog --backtitle "Audio Game Removal" \
|
||||
--clear \
|
||||
--no-tags \
|
||||
--menu "Please select a game to delete" 0 0 0 "${menuList[@]}" --stdout)"
|
||||
if [[ ${#game} -gt 0 ]]; then
|
||||
if [[ "$game" == "Donate" ]]; then
|
||||
open_url "https://ko-fi.com/stormux"
|
||||
exit 0
|
||||
fi
|
||||
if [[ "$game" == "Become a Patron" ]]; then
|
||||
open_url "https://2mb.games/product/2mb-patron/"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
dialog --backtitle "Linux Game Manager" \
|
||||
--yesno "mThis will remove the directory \"${game%/*}\" and all of its contents. Do you want to continue?." -1 -1 --stdout || exit 0
|
||||
{ rm -rfv "${game%/*}";
|
||||
sed -i "/${game//\//\\/}/d" "$configFile"; } | dialog --backtitle "Linux Game Manager" --progressbox "Removing game..." -1 -1
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
# launch games that are installed
|
||||
game_launcher() {
|
||||
mapfile -t lines < <(sed '/^$/d' "${configFile}" 2> /dev/null)
|
||||
@ -425,6 +462,7 @@ declare -A command=(
|
||||
[L]="Display license information."
|
||||
[N]="No cache, delete the installer after it has been extracted."
|
||||
[R]="Redownload. Removes old versions of packages from cache before installing."
|
||||
[r]="Remove game. Remove a game and its menu entry."
|
||||
[t]="Total games. Show how many games are currently available."
|
||||
)
|
||||
|
||||
@ -440,6 +478,7 @@ while getopts "${args}" i ; do
|
||||
L) license ;;
|
||||
N) noCache="true" ;;
|
||||
R) redownload="true" ;;
|
||||
r) game_removal ;;
|
||||
t)
|
||||
dialog --backtitle "Linux Game Manager" \
|
||||
--infobox "There are currently ${#gameList[@]} games available." -1 -1
|
||||
|
Loading…
Reference in New Issue
Block a user