Skip to content

Instantly share code, notes, and snippets.

@d0rc
Created June 22, 2014 22:53
Show Gist options
  • Select an option

  • Save d0rc/7095c55727715f0e6980 to your computer and use it in GitHub Desktop.

Select an option

Save d0rc/7095c55727715f0e6980 to your computer and use it in GitHub Desktop.
options_generator.ex
defmodule Options do
@proto_version "1.0"
def process_options(opts) do
log_opt ++
Enum.map(opts, fn
{:in, true} -> ["-in"]
{:err, :out} -> ["-err", "out"]
{:err, :err} -> ["-err", "err"]
{:dir, dir} -> ["-dir", dir]
_ -> []
end)
|> List.flatten
end
defp log_opt do
["-proto", @proto_version] ++
case :application.get_env(:porcelain, :goon_driver_log) do
:undefined -> []
{:ok, val} -> ["-log", val]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment