简体   繁体   中英

Is There A Built In IEX Command To Invoke Formatting?

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM