diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2020-10-05 20:35:51 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2020-10-05 20:35:51 +0200 |
commit | 414155c2827b08e99a57163d4f7aa8d04db9a154 (patch) | |
tree | 80b94fdc3c75ea64b99b094c2dd783712e0f8a10 | |
parent | 598653a4cc89d5588315607a367a87083b73da7c (diff) | |
download | minecraft-isekai-414155c2827b08e99a57163d4f7aa8d04db9a154.tar.gz |
list functions
-rwxr-xr-x | builder.sh | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -61,6 +61,15 @@ function world_exists() { return $? } +function world_list() { + for WORLD in $WORLDS/*/; do + WORLD=$(basename $WORLD) + [ -e "$WORLDS/$WORLD.lock" ] && source "$WORLDS/$WORLD.lock" + [ -z "$ASSIGNED_TO" ] || WORLD="$WORLD (-> $ASSIGNED_TO)" + echo $WORLD + done +} + # 1: world 2: instance function world_assign() { local WORLD="$1" @@ -107,6 +116,29 @@ function instance() { exit $? } +function instance_list() { + for INSTANCE in $INSTANCES/*/; do + INSTANCE="$(basename "$INSTANCE")" + instance_status "$INSTANCE" > /dev/null 2>&1 && INSTANCE+=" (RUNNING)" + echo "$INSTANCE" + done + return 0 +} + +function instance_status() { + instance_exists "$1" || fail "instance $1 not found." + + local PWD="$(pwd)" + + cd "$INSTANCES/$1" + + $RUNNER status + local RET=$? + + cd "$PWD" + return $RET +} + function instance_exists() { [ -d "$INSTANCES/$1" ] return $? |