work on interactive script

This commit is contained in:
nelle 2023-06-21 00:36:50 -06:00
parent cd6512a744
commit 096df006ca

116
interactive-setup.sh Normal file → Executable file
View file

@ -1 +1,117 @@
#!/bin/bash
echo 'Welcome! We will ask you a few questions to get set up.'
echo 'please note if you fuck up typing you will fuck up your mod, but you can fix it manually cant you :)'
echo '______'
echo 'First lets get your mod name and description'
echo '______'
echo 'Human Readable Mod Name:'
read modnamehr
echo 'Mod Name - example_mod :'
read modnameus
echo 'Mod Name - Case - ExampleMod:'
read modnamecase
echo 'Mod Description - "this mod does stuff!"'
read moddesc
echo '______'
echo 'okay now lets get some information about you'
echo '______'
echo 'Your Name - or Username:'
read uname
echo 'Your website - backwards - com.example:'
read website
echo 'now split it up... so'
echo 'website tld - ie "com" from com.example'
read websitetld
echo 'and the root.. ie "example" from com.example'
read websiteroot
echo '______'
echo 'okay now some links!'
echo '______'
echo 'Mod Homepage - https://example.com/:'
read homepage
echo 'Mod Source - https://github.com/QuiltMC/quilt-template-mod/issues:'
read source
echo 'Mod Issue Tracker- https://github.com/QuiltMC/quilt-template-mod:'
read issues
echo '______'
# list vars
echo 'OK. here is what you typed...'
echo $modnamehr, $modnameus, $modnamecase, $uname, $website, $homepage, $soure, $issues, $websiteld, $websiteroot, $moddesc
echo '______'
echo 'Setting you up....'
# edit gradle properties
sed -i ./gradle.properties -e "7s/com.example/${website}/"
sed -i ./gradle.properties -e "8s/example_mod/${modnameus}/"
# edit namespace
## Folders
mv -r ./src/main/java/com/example/example_mod ./src/main/java/${websitetld}/${websiteroot}/${modnameus}
rm -r ./src/main/java/com
mv -r ./src/main/resources/assets/example_mod ./src/main/resources/assets/${modnameus}
## Packages/filenames
mv ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/ExampleMod.java ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/${modnamecase}.java
mv ./src/main/java/example_mod.mixins.json ./src/main.java/${modnameus}.mixins.json
# edit file lines.... this is going to suck to type out lol....
####remember sed -i <FILE-TO-EDIT> -e "<line>s/<texttoedit>/<texttoinpu>"
## Main Package
### package
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/${modnamecase}.java -e "1s/com.example.example_mod/${websitetld}.${websiteroot}.${modnameus}/"
### class
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/${modnamecase}.java -e "8s/ExampleMod/${modnamecase}/"
### MOD_ID
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/${modnamecase}.java -e "10s/example_mod/${modnameus}/"
### Logger Name
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/${modnamecase}.java -e "15s/Example Mod/${modnamehr}/"
## TitleScreenMixin
### package
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/mixin/TitleScreenMixin.java -e "1s/com.example.example_mod/${websitetld}.${websiteroot}.${modnameus}.mixin/"
### Main Class Import
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/mixin/TitleScreenMixin.java -e "3s/com.example.example_mod.ExampleMod/${websitetld}.${websiteroot}.${modnameus}/"
### Logger Class
sed -i ./src/main/java/${websitetld}/${websiteroot}/${modnameus}/mixin/TitleScreenMixin.java -e "13s/ExampleMod/${modnamecase}/"
## RESOURCES (mixins.json and quilt.mod.json)
### package name in *.mixins.json
sed -i ./src/main/resources/${modnameus}.mixins.json -e "4s/com.example.example_mod/${websitetld}.${websiteroot}.${modnameus}/"
#### quilt.mod.json
### group section
sed -i ./src/main/resources/quilt.mod.json -e "4s/com.example/${websitetld}.${websiteroot}/"
### id section
sed -i ./src/main/resources/quilt.mod.json -e "5s/example_mod/${modnameus}/"
### name section
sed -i ./src/main/resources/quilt.mod.json -e "8s/Mod name/${modnamehr}/"
### description section
sed -i ./src/main/resources/quilt.mod.json -e "9s/A short description of your mod./${moddesc}/"
### contributors section
sed -i ./src/main/resources/quilt.mod.json -e "11s/Your name here/${uname}/"
### homepage section
sed -i ./src/main/resources/quilt.mod.json -e "14s/https://example.com/${homepage}/"
### icon secion
sed -i ./src/main/resources/quilt.mod.json -e "18s/example_mod/${modnameus}/"
### entrypoints init section
sed -i ./src/main/resources/quilt.mod.json -e "22s/com.example.example_mod.ExampleMod/${websitetld}.${websiteroot}.${modnameus}.${modnamecase}/"
### mixin section
sed -i ./src/main/resources/quilt.mod.json -e "39s/example_mod/${modnameus}/"