Open michalmuskala opened 7 years ago
The PR I have in OTP https://github.com/erlang/otp/pull/1420 lets you configure the path for logs through a kernel env var (the paths are also moved to ~/.cache/ by default). Would this mechanism make sense for you here?
Yes, I think it would be possible for iex
to automatically configure this, though it might be hard to do this reliably in a cross-platform way. On the erlang side the use of filename:basedir/2
makes it quite easy, but both iex
and lfe
are simple bash/batch scripts, so they don't have access to this.
Maybe a way to pass a path relative to the default one would be a solution?
I was more thinking of having their bash script add an item like -kernel shell_history_path ~/.cache/iex-history/
so they segment themselves on their own.
It's not as simple - filename:basedir
uses ~/.cache
only on Linux. On macOS it will use ~/Library/Caches
, etc - on each platform according to the platform's conventions.
yeah but they can just put it into ~/.erlang-history
like this library currently does, but with their own prefix. The path is configurable, I don't really have to worry what it is configured to if you don't want the default?
It is worth pointing out that you can have the same shell running multiple languages. Just press Ctrl+G and start a new session in whatever language you like. So I would say this needs to be configurable per session, much like the expand_fun
option is configured per session directly via io:setopts
. However I am not sure if this is a possibility.
There is no way to do such thing since there is no context to pass around for it nor is there any way to identify a session.
Currently, all logs are stored together. That's completely fine, but it becomes problematic when using multiple different repls -
erl
,iex
andlfe
since all history is stored together. So now I can "scroll up" elixir commands in lfe or erlang - this is not desirable.Both lfe and iex achieve the custom repl by passing the
-user
argument toerl
executable. This argument can be obtained usinginit:get_argument(user)
- I'm not sure if there exists a more internal API exposing an already parsed value.I propose to store logs in
~/.erlang-hostory/<user>/
directory, where<user>
is the value of the init argument. As far as I understand the code, this will allow separating the Erlang, Elixir and LFE shell history rather easily.