by erszcz

erszcz / docsh

Erlang Docs in the Shell

125 Stars 7 Forks Last release: Not found Other 539 Commits 9 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Docs in the Shell

TravisCI Build Status Hex version badge

Still can't remember if it's

(Tab, Key)
(Key, Tab)
? What about
? Hint: it's not the same! Ever wished for access to function signatures and documentation straight from
the way it's possible in languages like Python, Ruby or Elixir?

docsh - light and dark background

Use in Rebar3 shell

Add these lines to your

  {rebar3_docsh, "0.7.2", {pkg, docsh}}
{shell, [{script_file, "_build/default/plugins/rebar3_docsh/priv/docsh_rebar3_shell.escript"}]}.

rebar3 shell
will now have a set of new helpers to access docs. Start with

Note: This will dynamically compile and load a

module shipped with docsh. It will override your own
if you use one.

Use in

git clone
cd docsh

The script will ask if you're sure you want to create some Erlang configuration files:

$ ./

Installing docsh

This install script will make docsh globally available in your user environment. It will install the following files:

/Users/erszcz/.erlang /Users/erszcz/.erlang.d/user_default.erl

To know more about these files please refer to:

man erl - sections about 'The .erlang startup file' and 'user_default and shell_default' man shell_default - parts about user_default

Do you want to proceed? [y/N]

Even if you agree to install, but the target files exist, it won't proceed - don't worry if you have customized your Erlang environment already.

Once the installation is complete,

will greet you in a bit different way than you might be used to:
$ erl
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]

Enabled docsh from: /Users/erszcz/work/erszcz/docsh Eshell V8.2 (abort with ^G) 1>

Access docs in the shell

Let's see what docsh can give us for some OTP modules. We call

to get the doc for
no matter the arity:
$ erl
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]

Enabled docsh from: /Users/erszcz/work/erszcz/docsh/_build/default/lib/docsh Call h(docsh) for interactive help.

Eshell V8.2 (abort with ^G) 1> h(proplists).


Support functions for property lists.

Property lists are ordinary lists containing entries in the form of either tuples, whose first elements are keys used for lookup and insertion, or atoms, which work as shorthand for tuples {Atom, true}. (Other terms are allowed in the lists, but are ignored by this module.) If there is more than one entry in a list for a certain key, the first occurrence normally overrides any later (irrespective of the arity of the tuples).

Property lists are useful for representing inherited properties, such as options passed to a function where a user may specify options overriding the default settings, object properties, annotations, etc.

% @type property() = atom() | tuple()

ok 2> t(proplists). -type property() :: atom() | tuple(). -type proplist() :: [property()]. ok 3>

Let's try with Recon:

git clone
cd recon
./rebar compile
erl -pa ebin/

Once in the Erlang shell:

Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]

Enabled docsh from: /Users/erszcz/work/erszcz/docsh/_build/default/lib/docsh Call h(docsh) for interactive help.

Eshell V8.2 (abort with ^G) > s(recon_trace, calls).


-spec calls(tspec() | [tspec(), ...], max()) -> num_matches().


-spec calls(tspec() | [tspec(), ...], max(), options()) -> num_matches().

ok > h(recon_trace, calls, 2).


-spec calls(tspec() | [tspec(), ...], max()) -> num_matches().

Equivalent to calls({Mod, Fun, Args}, Max, []) See calls/3

ok >

As you can see above,

gives us just the function specs. Having read them, we want a more detailed description of
, so we ask for the doc and specify the arity with

Try it with your project!

Embed docs in your modules

Make sure to document your code with EDoc. Then add the following to your project's

  {rebar3_docsh, "0.7.2", {pkg, docsh}}

{provider_hooks, [ {post, [{compile, {docsh, compile}}]} ]}.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.