Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

erlang shell help for a module's function

I'm working in the shell and I want to view the help for the function io:format/1.

My thought path is as follows:

  1. execute help() - I find the command m().
  2. execute m(io) - I see a list of the functions in the io module

Question: How do I drill down to find the help for the function io:format/1 from the erlang Shell?


Output from help().:

1> help().
...
m(Mod)     -- information about module <Mod>
memory()   -- memory allocation information
...
true

Output from m(io).:

2> m(io).
Module io compiled: Date: July 10 2013, Time: 10.46
Compiler options:  [{outdir,"/build/buildd/erlang-16.b.1-dfsg/lib/stdlib/src/../ebin"},
                    {i,"/build/buildd/erlang-16.b.1-dfsg/lib/stdlib/src/../include"},
                    {i,"/build/buildd/erlang-16.b.1-dfsg/lib/stdlib/src/../../kernel/include"},
                    warnings_as_errors,debug_info]
Object file: /usr/lib/erlang/lib/stdlib-1.19.2/ebin/io.beam
Exports: 
columns/1                     parse_erl_form/2
columns/0                     parse_erl_form/3
format/1                      parse_erl_form/4
format/2                      printable_range/0
format/3                      put_chars/2
...
parse_erl_exprs/4             setopts/2
parse_erl_exprs/3             setopts/1
parse_erl_form/1              write/1
                              write/2
ok
like image 895
Chris Snow Avatar asked Feb 12 '23 01:02

Chris Snow


1 Answers

The help texts for the functions in the standard library are not accessible to Erlang programs and shell sessions, unlike Python, Lisp etc.

The way I've settled for to find documentation is a special Firefox bookmark for the URL http://www.erlang.org/doc/man/%s.html. I assigned e as a hotkey for that bookmark, such that I can type e io in the Firefox address bar and get redirected to http://www.erlang.org/doc/man/io.html, which has the documentation for the functions in the io module.

Alternatively, you might find http://erldocs.com/ useful. It lets you type the name of the function you're looking for and jump directly to its documentation.

like image 175
legoscia Avatar answered Apr 10 '23 06:04

legoscia