iex

Another way to exiting IEX other than ctrl-C

风格不统一 提交于 2019-12-02 20:15:37
I know we can exit the IEX console with control-C. I'm curious if there's a command to type into the console that would also do the same thing. I can think of 3 ways to quit an IEx shell: The mentioned <ctrl-c> hit twice or once followed by q and then <enter> , <ctrl-g> and then q + <enter> , and finally System.halt , but there is a difference between System.halt and the others. Namely that System.halt " halts the Erlang runtime " and the others just " quit the shell ". When you have only one shell session running or the session is not attached to a separate runtime then both ways will produce

Is there a Phoenix equivalent to Rails Console

馋奶兔 提交于 2019-12-02 16:54:39
I'm just learning Phoenix and Elixir and I'm coming from Ruby/Rails where I work in the REPL using pry to inspect my database and application state. I'm trying to figure out how to interact with my database and models in a Phoenix app. I'm aware of iex , but I don't know how to use it inspect my app's database from the repl. Do I need to connect to it with ecto each time from the repl? Is there a rails console equivalent. I've checked the Phoenix docs, Elixir Dose, and the Ecto repo, but can't find what I'm looking for. Am I missing something? Edit: Based on the answer below I found this

How to make custom prompt take effect at iex start?

时光毁灭记忆、已成空白 提交于 2019-11-30 08:35:48
问题 I have a custom prompt but when I launch iex , a builtin prompt shows. After I hit enter my prompt takes effect. How can I make my prompt take effect when iex starts? Here's what I'm seeing: And this is my .iex.exs file: IEx.configure( colors: [ enabled: true], default_prompt: [ "\e[G", # move to column 1 "\e[35m", # magenta "MY %prefix(%counter)", ">", "\e[0m" # reset ] |> IO.chardata_to_string ) 回答1: It's a bug in iex . I've tracked down and fixed it: https://github.com/elixir-lang/elixir

Pry while testing

天涯浪子 提交于 2019-11-30 07:48:34
I'm pretty new in Elixir, but have a lot fun with it! I came from Ruby world, so start looking analogy. And there is exist debugging tool pry . Using binding.pry I can interrupt any session. I found something similar in Elixir – IEx.pry . But it doesn't work when I'm testing something through ExUnit . Question – is it is possible to interrupt testing session and run iex with current environment? You need to start your tests inside an iex session - you can do that by running iex -S mix test . Then you can use IEx.pry inside your test: require IEx test "the truth" do one = 1 IEx.pry assert one +

How to make custom prompt take effect at iex start?

此生再无相见时 提交于 2019-11-29 07:17:21
I have a custom prompt but when I launch iex , a builtin prompt shows. After I hit enter my prompt takes effect. How can I make my prompt take effect when iex starts? Here's what I'm seeing: And this is my .iex.exs file: IEx.configure( colors: [ enabled: true], default_prompt: [ "\e[G", # move to column 1 "\e[35m", # magenta "MY %prefix(%counter)", ">", "\e[0m" # reset ] |> IO.chardata_to_string ) It's a bug in iex . I've tracked down and fixed it: https://github.com/elixir-lang/elixir/pull/4895 来源: https://stackoverflow.com/questions/37974476/how-to-make-custom-prompt-take-effect-at-iex-start