40 lines
1.3 KiB
Bash
Executable File
40 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
if [ $# -eq 0 ]; then
|
|
echo "Usage: `basename $0` [options] [.exs file] [data]
|
|
|
|
-v Prints version and exit
|
|
-e \"command\" Evaluates the given command (*)
|
|
-r \"file\" Requires the given files/patterns (*)
|
|
-pr \"file\" Requires the given files/patterns in parallel (*)
|
|
-pa \"path\" Prepend the given path to Erlang code path (*)
|
|
-pz \"path\" Append the given path to Erlang code path (*)
|
|
--no-halt Do not halt the Erlang VM after execution
|
|
|
|
** Options marked with (*) can be given more than once;
|
|
|
|
** Options given after the .exs file or -- are passed down to the executed code;
|
|
|
|
** Options can be passed to the erlang runtime using ELIXIR_ERL_OPTS." >&2
|
|
exit 1
|
|
fi
|
|
|
|
readlink_f () {
|
|
cd `dirname $1` > /dev/null
|
|
local filename=`basename $1`
|
|
if [ -h "$filename" ]; then
|
|
readlink_f `readlink $filename`
|
|
else
|
|
echo "`pwd -P`/$filename"
|
|
fi
|
|
}
|
|
|
|
SELF=`readlink_f $0`
|
|
SCRIPT_PATH=`dirname $SELF`
|
|
|
|
if [ -f "$SCRIPT_PATH/../releases/RELEASES" ] && [ -f "$SCRIPT_PATH/erl" ]
|
|
then
|
|
$SCRIPT_PATH/erl -env ERL_LIBS $ERL_LIBS:$SCRIPT_PATH/../lib -boot elixir -noshell $ELIXIR_ERL_OPTS -s elixir start_cli -extra "$@"
|
|
else
|
|
erl -env ERL_LIBS $ERL_LIBS:$SCRIPT_PATH/../lib -noshell $ELIXIR_ERL_OPTS -s elixir start_cli -extra "$@"
|
|
fi
|