summaryrefslogtreecommitdiff
path: root/bin/iex
blob: b84e1b3dd7545a7fbb21ba2b3125407d6273ef13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
set -e

if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
  cat <<USAGE >&2
Usage: $(basename "$0") [options] [.exs file] [data]

The following options are exclusive to IEx:

  --dbg pry           Sets the backend for Kernel.dbg/2 to IEx.pry/0
  --dot-iex "FILE"    Evaluates FILE, line by line, to set up IEx' environment.
                      Defaults to evaluating .iex.exs or ~/.iex.exs, if any exists.
                      If FILE is empty, then no file will be loaded.
  --remsh NAME        Connects to a node using a remote shell.

It accepts all other options listed by "elixir --help".
USAGE
  exit 1
fi

readlink_f () {
  cd "$(dirname "$1")" > /dev/null
  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")
exec "$SCRIPT_PATH"/elixir --no-halt --erl "-noshell -user Elixir.IEx.CLI" +iex "$@"