Is There A Built In IEX Command To Invoke Formatting?

Onorio Catenacci Source

I checked h and h(IEx) and didn't come up with anything.

I am sure I can shell out to a command prompt and run "mix format" but I was wondering if I'm missing something. Is there any command analogous to recompile/0 or r/1 for iex to allow me to reformat the source files in my project?

elixiriex

Answers

answered 3 months ago Dogbert #1

You can invoke the format mix task by calling Mix.Tasks.Format.run/1 using whatever arguments you'd pass to mix format. For example, mix format "**/*.{ex,exs}" would be:

iex(1)> Mix.Tasks.Format.run ["**/*.{ex,exs}"]
:ok

comments powered by Disqus