Implement --edit-config
This commit is contained in:
parent
b017c00a6c
commit
dc45b90d98
15
msman.sh
15
msman.sh
@ -404,9 +404,9 @@ function load_script {
|
||||
first_run() {
|
||||
if [[ $first_run == true ]]; then
|
||||
answer=""
|
||||
echo "Since eula wasn't accepted, this is probably the first run of the server"
|
||||
echo "Since eula wasn't accepted, this is probably the first run of the server."
|
||||
echo "If you want to install plugins (or mods), answer 'n' and you can do so."
|
||||
echo "If you don't answer, the server will start in 15 secondd."
|
||||
echo "If you don't answer, the server will start in 15 seconds."
|
||||
read -t 15 -p "Do you want to start the server now? [Y/n] " answer
|
||||
if [ "$answer" == "n" ] || [ "$answer" == "N" ]; then
|
||||
echo "Exiting..."
|
||||
@ -459,20 +459,27 @@ function main {
|
||||
launch_server
|
||||
}
|
||||
|
||||
# Check for updates on GitHub
|
||||
if [[ "$1" == "--redownload" ]] || [[ "$1" == "-r" ]]; then
|
||||
get_latest_script_release
|
||||
self_update
|
||||
# Reload the script
|
||||
exec "$0"
|
||||
exit 0
|
||||
# TODO: Add `--edit-config` option
|
||||
elif [[ "$1" == "--edit-config" ]] || [[ "$1" == "-e" ]]; then
|
||||
if [[ command -v $EDITOR &> /dev/null ]]; then
|
||||
$EDITOR msman.cfg
|
||||
else
|
||||
echo "EDITOR is not set."
|
||||
echo "Open 'msman.cfg' manually."
|
||||
fi
|
||||
exit 1
|
||||
elif [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]]; then
|
||||
echo "Usage: ./script.sh [OPTION]"
|
||||
echo "Starts the Minecraft server."
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -r, --redownload Redownloads the script from GitHub."
|
||||
echo " -e, --edit-config Edit the config file."
|
||||
echo " -h, --help Show this help message."
|
||||
echo
|
||||
echo "To change the settings of the script, edit the 'msman.cfg' file."
|
||||
|
Loading…
x
Reference in New Issue
Block a user