Created
June 22, 2014 22:53
-
-
Save d0rc/7095c55727715f0e6980 to your computer and use it in GitHub Desktop.
options_generator.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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