Parse command-line arguments: Difference between revisions

Content added Content deleted
(Omit Axe)
(added Elixir argument parser)
Line 113: Line 113:
verbose: true
verbose: true
color: no</pre>
color: no</pre>

=={{header|Elixir}}==
Elixir provides an option parser in a library module called <tt>OptionParser</tt>.

<lang elixir>#!/usr/bin/env elixir
IO.puts 'Arguments:'
IO.inspect OptionParser.parse(System.argv())</lang>

<lang bash>$ ./parse-args.exs --a --b --c=yes --no-flag --verbose -V -a=1 -b=t -- apple banana
Arguments:
{[a: true, b: true, c: "yes", no_flag: true, verbose: true],
["apple", "banana"], [{"-V", nil}, {"-a", "1"}, {"-b", "t"}]}</lang>


=={{header|Go}}==
=={{header|Go}}==