Skip to content

Commit

Permalink
Merge pull request #21 from ALLAN-DIP/improve-run_cicero.sh-args
Browse files Browse the repository at this point in the history
Improve argument handling for `run_cicero.sh`
  • Loading branch information
aphedges authored Jan 16, 2025
2 parents 96489b5 + 7367d06 commit 3a79503
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion scripts/run_cicero.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
#!/usr/bin/env bash

set -euxo pipefail
set -euo pipefail

SCRIPT_FILE=$(realpath "$0")
SCRIPT_NAME=$(basename "$SCRIPT_FILE")

function show_usage() {
{
echo "usage: bash $SCRIPT_NAME [--help] BOT_TAG BOT_TYPE BOT_ARGS..."
echo
echo 'Run CICERO from an OCI image using Docker.'
echo '- BOT_TAG is the tag assigned when building the image.'
echo '- BOT_TYPE is the type of bot to run and must be either "advisor" or "player".'
echo '- BOT_ARGS are passed as arguments to the script within the running container.'
} >&2
}

if [[ $# -lt 2 ]] || [[ ${1:-} = --help ]]; then
show_usage
exit 1
fi

BOT_TAG=$1
BOT_TYPE=$2
shift 2

if [[ $BOT_TYPE != advisor ]] && [[ $BOT_TYPE != player ]]; then
{
echo 'Invalid BOT_TYPE given: must be "advisor" or "player".'
echo
} >&2
show_usage
exit 1
fi

set -x

CICERO_DIR=/media/volume/cicero-base-models

GAME_COMMAND=(
Expand Down

0 comments on commit 3a79503

Please sign in to comment.