Skip to content

Commit

Permalink
Merge pull request #63 from Ominitay/tui-script
Browse files Browse the repository at this point in the history
QBeat-tui improvements
  • Loading branch information
geefr authored Dec 4, 2020
2 parents bb597c2 + 70c397d commit 87e8253
Showing 1 changed file with 27 additions and 24 deletions.
51 changes: 27 additions & 24 deletions tui-script/QBeat-tui
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/bash

args=$@
scriptname=`basename ${0}`
scriptpath=`dirname ${0}`

function usage {
# Outputs help menu; more to be added to in future, perhaps with more options.
cat <<EOF
Usage: ${0} [options]
Usage: ${scriptname} [options]
-h/? | Output this help page.
Expand Down Expand Up @@ -151,7 +153,7 @@ EOF
-----------------------------
EOF

./QBeat --setup-wine
${scriptpath}/QBeat --setup-wine
if [ $? == 1 ]
then
echo "-----------------------------"
Expand All @@ -160,7 +162,7 @@ EOF
break
fi

./QBeat --validate-wine
${scriptpath}/QBeat --validate-wine
if [ $? == 1 ]
then
echo "-----------------------------"
Expand All @@ -169,7 +171,7 @@ EOF
break
fi

./QBeat --install "BSIPA"
${scriptpath}/QBeat --install "BSIPA"
if [ $? == 1 ]
then
echo "-----------------------------"
Expand All @@ -178,7 +180,7 @@ EOF
break
fi

./QBeat --patch
${scriptpath}/QBeat --patch
if [ $? == 1 ]
then
echo "-----------------------------"
Expand Down Expand Up @@ -497,7 +499,7 @@ function action-installer-set-config {
echo -ne "\033[1A"
echo "$2: $configvalue"
fi
./QBeat --config set $2 "$configvalue"
${scriptpath}/QBeat --config set $2 "$configvalue"
}

function action-installer-set-version {
Expand All @@ -521,7 +523,7 @@ function action-installer-set-version {
then
echo -ne "\033[1A"
echo "Your input: ${versionsarray[0]//\"/}"
./QBeat --config set gameVersion "${versionsarray[0]//\"/}"
${scriptpath}/QBeat --config set gameVersion "${versionsarray[0]//\"/}"
if [ $? == 1 ]
then
echo "-----------------------------"
Expand All @@ -536,7 +538,7 @@ function action-installer-set-version {
else
echo -ne "\033[1A"
echo "Your input: ${versionsarray[$((selectedoption-1))]//\"/}"
./QBeat --config set gameVersion "${versionsarray[$((selectedoption-1))]//\"/}"
${scriptpath}/QBeat --config set gameVersion "${versionsarray[$((selectedoption-1))]//\"/}"
if [ $? == 1 ]
then
echo "-----------------------------"
Expand All @@ -554,7 +556,7 @@ function action-validate-wine {
# Validating Wine: #
-----------------------------
EOF
./QBeat --validate-wine
${scriptpath}/QBeat --validate-wine
if [ $? == 1 ]
then
echo "-----------------------------"
Expand All @@ -572,7 +574,7 @@ function action-setup-wine {
# Setting up Wine: #
-----------------------------
EOF
./QBeat --setup-wine
${scriptpath}/QBeat --setup-wine
if [ $? == 1 ]
then
echo "-----------------------------"
Expand All @@ -590,13 +592,13 @@ function action-patch-game {
# Patching game: #
-----------------------------
EOF
./QBeat --install "BSIPA"
${scriptpath}/QBeat --install "BSIPA"
if [ $? == 1 ]
then
echo "-----------------------------"
echo "ERROR: Installing BSIPA failed."
else
./QBeat --patch
${scriptpath}/QBeat --patch
if [ $? == 1 ]
then
echo "-----------------------------"
Expand All @@ -615,7 +617,7 @@ function action-validate-mods {
# Validating all mods: #
-----------------------------
EOF
./QBeat --validate-all
${scriptpath}/QBeat --validate-all
if [ $? == 1 ]
then
echo "-----------------------------"
Expand All @@ -638,7 +640,7 @@ like to validate.
EOF
echo -ne "Your input: "
read validatemod
./QBeat --validate $validatemod
${scriptpath}/QBeat --validate $validatemod
if [ $? == 1 ]
then
echo "-----------------------------"
Expand All @@ -656,7 +658,7 @@ function action-list-mods {
# Listing all mods: #
-----------------------------
EOF
./QBeat --list
${scriptpath}/QBeat --list
if [ $? == 1 ]
then
echo "-----------------------------"
Expand Down Expand Up @@ -688,7 +690,8 @@ EOF
else
for mod in "${modarray[@]}"
do
./QBeat --install $mod
echo "-----------------------------"
${scriptpath}/QBeat --install $mod
if [ $? == 1 ]
then
echo "-----------------------------"
Expand Down Expand Up @@ -722,7 +725,7 @@ EOF
else
for mod in "${modarray[@]}"
do
./QBeat --remove $mod
${scriptpath}/QBeat --remove $mod
if [ $? == 1 ]
then
echo "-----------------------------"
Expand All @@ -743,7 +746,7 @@ function action-config-get {
# Outputting config: #
-----------------------------
EOF
./QBeat --config get $1
${scriptpath}/QBeat --config get $1
if [ $? == 1 ]
then
echo "-----------------------------"
Expand All @@ -763,7 +766,7 @@ function action-config-set {
-----------------------------
EOF
echo "Current value: "
./QBeat --config get $1
${scriptpath}/QBeat --config get $1
echo "-----------------------------"
echo -ne "Input new value: "
read -e configvalue # -e enables bash autocompletion
Expand All @@ -772,15 +775,15 @@ EOF
echo "-----------------------------"
echo "ERROR: No value provided."
else
./QBeat --config set $1 "$configvalue"
${scriptpath}/QBeat --config set $1 "$configvalue"
if [ $? == 1 ]
then
echo "-----------------------------"
echo "ERROR: Setting $1 failed."
else
echo "-----------------------------"
echo "New value: "
./QBeat --config get $1
${scriptpath}/QBeat --config get $1
fi
fi
echo "-----------------------------"
Expand All @@ -797,7 +800,7 @@ function action-version-set {
-----------------------------
EOF
echo "Current value: "
./QBeat --config get gameVersion
${scriptpath}/QBeat --config get gameVersion
echo "-----------------------------"

versionsarray=( $( curl -sL https://beatmods.com/api/v1/version | sed -e 's/\[//' -e 's/\]//' -e 's/,/\n/g' ) )
Expand All @@ -824,15 +827,15 @@ EOF
echo "-----------------------------"
echo "ERROR: Invalid input."
else
./QBeat --config set gameVersion "${versionsarray[$((selectedoption-1))]//\"/}"
${scriptpath}/QBeat --config set gameVersion "${versionsarray[$((selectedoption-1))]//\"/}"
if [ $? == 1 ]
then
echo "-----------------------------"
echo "ERROR: Setting gameVersion failed."
else
echo "-----------------------------"
echo "New value: "
./QBeat --config get gameVersion
${scriptpath}/QBeat --config get gameVersion
fi
fi
echo "-----------------------------"
Expand Down

0 comments on commit 87e8253

Please sign in to comment.