Grepping 'h' function output - how do you use it?

Hey forum,

I’m brand new to Elixir and curious how people search “h” results.

For example, I might want to run iex> h String and search for uppercase to I can remember the upcase function.

I use tabs:

iex> h String.<TAB> 
(list of all functions)

iex>h String.up<TAB>case 

On MacOS, I pair it with Dash for macOS - API Documentation Browser, Snippet Manager - Kapeli
CMD+Shift+Space> String

2 Likes

I use Dash for searching through documentation.

4 Likes

Personally since I’m always in a tmux window I use tmux to search the output.

I’m not sure you can capture the output of h in an elixir variable.

But you can create a bash script with this single line: elixir -e "import IEx.Helpers;h($1)", and then call h from your shell.

Now, that will not show you the exported functions, but the exports function/macro will. So you could create another script. or a script that would take the name of a function in IEx.Helpers as the first argument.

This was a weekend hack project that might interest you.

I haven’t touched it in a year and don’t remember why I did what I did but I still use it :slight_smile: I wanted the output of “h” sent to STDOUT so I could pipe it through fzf to search.

4 Likes

thanks so much for these suggestions!