Skip to content

Instantly share code, notes, and snippets.

@joshchernoff joshchernoff/cli.ex
Last active Nov 14, 2018

Embed
What would you like to do?
defmodule Sequencer.CLI do
def main(args \\ []) do
if length(args) > 0 do
# Got something from args
IO.inspect(args)
else
# Got something from STDIN
case IO.read(:stdio, :line) do
:eof ->
:ok
{:error, reason} ->
IO.puts("Error: #{reason}")
data ->
IO.write(:stdio, data)
Sequencer.CLI.main()
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.