Search code examples
command-line-interfaceelixirelixir-iex

How to implement some commands on starting iex session?


Let say I want to implement a few commands on starting iex in root path of my project, like:

Logger.configure(level: :info)
require Ecto.Query
alias MyApp.User
# and so on

And I want to implement all of these commands on every starting of iex automatically. Another thing I want - is to make this setting only for one project (for example, I wouldn't have MyApp.User on another project, so I don't need to use it accross all iex of the system). How can I do that?


Solution

  • In your project root create a file called .iex.exs and add the commands there. That should do the trick.