Shell history - Erlang shell has h() - does Elixir have an equivalent?

Hi,

Maybe I’m missing something, but on the Erlang shell an the IEx shell you can use up/down arrows to select a previous command. The Erlang shell had the h(). option to show the history and a h(Val). to select an entry from the history. I don’t see the equivalent in Elixir.

Am I blind or correct here?

1 Like

I’m not aware of something that shows the history, though at least old values are fetchable through the v/1 helper.

2 Likes

If you set export ERL_AFLAGS="-kernel shell_history enabled" this kind of works:

Enum.reverse(:group_history.load()) |> Enum.reduce(1, fn cmd, count -> IO.puts("\e[31m#{count}:\e[33m #{String.trim(to_string(cmd))}"); count+1 end)
1 Like