The mix tool is an elixir script. It's entry point is Mix.ClI.main()
.
When you execute mix
at your shell that is all that is called.
Remember that elixir is written in erlang.
Erlang is able to find the compiled Mix.CLI
module because the elixir shell script gives the erl
executable a list of places to look for compiled beam modules.
The Mix.CLI module simply compiles the mix.exs file in the current directory and stores the configuration in memory. It then looks for a Task with the same name as the argument it was given, compiles it and executes it.
Tasks define their own command line arguments, help, and behavior. It's a neat way to structure an extendable command line program.