Skip to content

Instantly share code, notes, and snippets.

@alco
Created May 15, 2014 18:49
Show Gist options
  • Save alco/be52c4c114c8f30498a0 to your computer and use it in GitHub Desktop.
Save alco/be52c4c114c8f30498a0 to your computer and use it in GitHub Desktop.
iex(1)> OptionParser.parse(["--hello", "world"])
{[hello: "world"], [], []}
iex(2)> OptionParser.parse(["--hello", "world"], switches: [hello: [:string]])
{[hello: "world"], [], []}
iex(3)> OptionParser.parse(["--hello", "world"], switches: [hello: [:string, :optional]])
{[hello: nil], ["world"], []}
iex(4)> OptionParser.parse(["--hello=world"], switches: [hello: [:string, :optional]])
{[hello: "world"], [], []}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment