#! /usr/bin/env bash
#
#	Version of _stone script designed to be embedded in the GemStone product tree.
#
#	Expected script command line:
#		using $ARCHBASE or $GEMSTONE
#			script -I <topazini-path> ( -L | -l | -r ) [ <topaz-command-line-args> ]
#
#	Not worried about duplicate topaz options at this point ... let the cards fall where they may
#

set -e

export SUPERDOIT_CURRENT_DIR="`pwd`"
export SUPERDOIT_DIR="$GEMSTONE/projects/superDoit"

# process command line args
#		collect scriptFile, then scan for scriptArgs, if -- encountered, 

scriptFile=$1
shift

for arg in "$@"; do

	topazArgs="$topazArgs $arg"
	shift
done

skip="skip"
if [ "$skip"x = "x" ] ; then
	echo "======================"
	echo "script file: $scriptFile"
	echo "stone name: $stoneName"
	echo "topaz args: $topazArgs"
	echo "script args: $scriptArgs"
	echo "======================"
	# exit 0
fi

$GEMSTONE/bin/topaz $defaultTopazArgs $topazArgs $topaziniArgs -S $scriptFile

