Slides for brief talk about writing CLI applications with Elixir with sample application
How do you define main?
In mix.exs, you can use the escript parameter to specify which module has the main function.
def project do [app: :elixir_cli_talk, version: "0.0.1", elixir: "~> 1.0", build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, escript: escript, deps: deps] end def escript do [main_module: ElixirCliTalk] end
You can then build a escript executable using the command
mix escript.build