command - iex

manpage

執行

$ man ~/.asdf/installs/elixir/1.2.2/man/iex.1

顯示

IEX(1)                                        BSD General Commands Manual                                       IEX(1)

NAME
     iex — The Elixir shell

SYNOPSIS
     iex [OPTIONS]

DESCRIPTION
     The interactive shell is used for evaluation, debugging and introspection of the Elixir runtime system. It is
     also possible to use the program for testing the work of small pieces of code escaping the stage of saving the
     code in a file.

OPTIONS
     Note that many of the options mentioned here were borrowed from the Erlang shell, therefore erl(1) can be used as
     an additional source of information on the options.

     --dot-iex file
             Loads the specified file instead of .iex.exs (see the FILES section).

     --remsh node
             Connects to the specified node which was started with the --sname or --name options (see above).

     --      Separates the options passed to the compiler from the options passed to the executed code.

ENVIRONMENT
     ELIXIR_ERL_OPTIONS
             Allows passing parameters to the Erlang runtime.

FILES
     ~/.erlang.cookie
             Stores the magic cookie value which is used only when it wasn't specified via the option --cookie (see
             above).  If the file doesn't exist when a node starts, it will be created.

     .iex.exs
             After iex starts, it seeks the file .iex.exs and, in a case of success, executes the code from the file
             in the context of the shell. At first the search starts in the current working directory, then, if neces‐
             sary, it continues in the home direcory.

SEE ALSO
     elixir(1), elixirc(1), mix(1)

AUTHOR
     This manual page contributed by Evgeny Golyshev.

INTERNET RESOURCES
     Main website: http://elixir-lang.org

     Documentation: http://elixir-lang.org/docs.html

     General Mailing List: https://groups.google.com/group/elixir-lang-talk

     Development Mailing List: https://groups.google.com/group/elixir-lang-core

BSD                                                 April 10, 2015                                                 BSD

help

執行

$ iex -h

或是執行

$ iex --help

顯示

Usage: iex [options] [.exs file] [data]

  -v                Prints version
  -e "command"      Evaluates the given command (*)
  -r "file"         Requires the given files/patterns (*)
  -S "script"       Finds and executes the given script
  -pr "file"        Requires the given files/patterns in parallel (*)
  -pa "path"        Prepends the given path to Erlang code path (*)
  -pz "path"        Appends the given path to Erlang code path (*)
  --app "app"       Start the given app and its dependencies (*)
  --erl "switches"  Switches to be passed down to Erlang (*)
  --name "name"     Makes and assigns a name to the distributed node
  --sname "name"    Makes and assigns a short name to the distributed node
  --cookie "cookie" Sets a cookie for this distributed node
  --hidden          Makes a hidden node
  --werl            Uses Erlang's Windows shell GUI (Windows only)
  --detached        Starts the Erlang VM detached from console
  --remsh "name"    Connects to a node using a remote shell
  --dot-iex "path"  Overrides default .iex.exs file and uses path instead;
                    path can be empty, then no file will be loaded

** 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 VM using ELIXIR_ERL_OPTIONS or --erl

source code

iex

執行

$ cat ~/.asdf/installs/elixir/1.2.2/bin/iex

顯示

#!/bin/sh
if [ $# -gt 0 ] && ([ "$1" = "--help" ] || [ "$1" = "-h" ]); then
  echo "Usage: `basename $0` [options] [.exs file] [data]

  -v                Prints version
  -e \"command\"      Evaluates the given command (*)
  -r \"file\"         Requires the given files/patterns (*)
  -S \"script\"       Finds and executes the given script
  -pr \"file\"        Requires the given files/patterns in parallel (*)
  -pa \"path\"        Prepends the given path to Erlang code path (*)
  -pz \"path\"        Appends the given path to Erlang code path (*)
  --app \"app\"       Start the given app and its dependencies (*)
  --erl \"switches\"  Switches to be passed down to Erlang (*)
  --name \"name\"     Makes and assigns a name to the distributed node
  --sname \"name\"    Makes and assigns a short name to the distributed node
  --cookie \"cookie\" Sets a cookie for this distributed node
  --hidden          Makes a hidden node
  --werl            Uses Erlang's Windows shell GUI (Windows only)
  --detached        Starts the Erlang VM detached from console
  --remsh \"name\"    Connects to a node using a remote shell
  --dot-iex \"path\"  Overrides default .iex.exs file and uses path instead;
                    path can be empty, then no file will be loaded

** 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 VM using ELIXIR_ERL_OPTIONS or --erl" >&2
  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 "-user Elixir.IEx.CLI" +iex "$@"