Skip to content

Commit 5d00a9f

Browse files
author
José Valim
committed
Support --help and -h in elixir and iex, closes #854
1 parent 6024014 commit 5d00a9f

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

bin/elixir

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/sh
2-
if [ $# -eq 0 ]; then
2+
if [ $# -eq 0 ] || [ $1 = "--help" ] || [ $1 = "-h" ]; then
33
echo "Usage: `basename $0` [options] [.exs file] [data]
44
5-
-v Prints version and exit
5+
-v Prints version
66
-e \"command\" Evaluates the given command (*)
77
-r \"file\" Requires the given files/patterns (*)
88
-S \"script\"   Finds and executes the given script (*)
@@ -13,7 +13,6 @@ if [ $# -eq 0 ]; then
1313
--erl \"switches\" Switches to be passed down to erlang (*)
1414
--name \"name\" Makes and assigns a name to the distributed node
1515
--sname \"name\" Makes and assigns a short name to the distributed node
16-
--remsh \"name\" Connects to a node using a remote shell (with iex)
1716
--detached Starts the Erlang VM detached from console
1817
--no-halt Does not halt the Erlang VM after execution
1918

bin/iex

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,26 @@
11
#!/bin/sh
2+
if [ $# -gt 0 ] && ([ $1 = "--help" ] || [ $1 = "-h" ]); then
3+
echo "Usage: `basename $0` [options] [.exs file] [data]
4+
5+
-v Prints version
6+
-e \"command\" Evaluates the given command (*)
7+
-r \"file\" Requires the given files/patterns (*)
8+
-S \"script\"   Finds and executes the given script (*)
9+
-pr \"file\" Requires the given files/patterns in parallel (*)
10+
-pa \"path\" Prepends the given path to Erlang code path (*)
11+
-pz \"path\" Appends the given path to Erlang code path (*)
12+
--app \"app\" Start the given app and its dependencies (*)
13+
--erl \"switches\" Switches to be passed down to erlang (*)
14+
--name \"name\" Makes and assigns a name to the distributed node
15+
--sname \"name\" Makes and assigns a short name to the distributed node
16+
--remsh \"name\" Connects to a node using a remote shell
17+
18+
** Options marked with (*) can be given more than once
19+
** Options given after the .exs file or -- are passed down to the executed code
20+
** Options can be passed to the erlang runtime using ELIXIR_ERL_OPTS or --erl" >&2
21+
exit 1
22+
fi
23+
224
readlink_f () {
325
cd "$(dirname "$1")" > /dev/null
426
local filename="$(basename "$1")"

0 commit comments

Comments
 (0)