Hello,
You need escript for this job for example in your mix.exs you must pass
escript: [main_module: MyApp]
then in your module define something like this:
defmodule MyApp do
def main(args) do
args |> parse_args |> process
end
def process([]) do
IO.puts "No arguments given"
end
def process(options) do
IO.puts "Hello #{options[:name]}"
end
defp parse_args(args) do
{options, _, _} = OptionParser.parse(args, switches: [name: :string])
options
end
end
finally from the command line:
mix escript.build
$ ./my_app --name=Elixir






















