如何在启动iex会话时实施一些命令? [英] How to implement some commands on starting iex session?

查看:48
本文介绍了如何在启动iex会话时实施一些命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我想在我的项目的根路径中启动一些有关启动iex的命令,例如:

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

我想在iex的每次启动时自动实现所有这些命令.我想做的另一件事-是仅对一个项目进行此设置(例如,我不会在另一个项目上使用 MyApp.User ,因此我不需要在所有Iex上使用它系统).我该怎么办?

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?

推荐答案

在项目根目录中,创建一个名为 .iex.exs 的文件,然后在其中添加命令.那应该可以解决问题.

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

这篇关于如何在启动iex会话时实施一些命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆