From c1beb7126c580061b2a49604e0b273e1e128a941 Mon Sep 17 00:00:00 2001 From: Pierre Fenoll Date: Fri, 19 Apr 2019 13:25:25 +0200 Subject: [PATCH 1/3] allow printing to specific device Signed-off-by: Pierre Fenoll --- lib/scribe.ex | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/scribe.ex b/lib/scribe.ex index b98f513..0c4fc2b 100644 --- a/lib/scribe.ex +++ b/lib/scribe.ex @@ -75,15 +75,15 @@ defmodule Scribe do +----------+---------+ :ok """ - @spec print(data, format_opts) :: :ok - def print(_results, opts \\ []) + @spec print(IO.device(), data, format_opts) :: :ok + def print(dev \\ :stdio, _results, opts \\ []) - def print([], _opts), do: :ok + def print(_dev, [], _opts), do: :ok - def print(results, opts) do + def print(dev, results, opts) do results |> format(opts) - |> IO.puts() + |> IO.puts(dev) end def console(results, opts \\ []) do From 7091cc77974fa07a46f5278d58afb3a040ca0f1c Mon Sep 17 00:00:00 2001 From: Pierre Fenoll Date: Fri, 19 Apr 2019 13:25:29 +0200 Subject: [PATCH 2/3] mix format Signed-off-by: Pierre Fenoll --- config/config.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.exs b/config/config.exs index 352a632..b237445 100644 --- a/config/config.exs +++ b/config/config.exs @@ -27,4 +27,4 @@ use Mix.Config # Configuration from the imported file will override the ones defined # here (which is why it is important to import them last). # -import_config "#{Mix.env}.exs" +import_config "#{Mix.env()}.exs" From f317017ff84eb80450479f0ccae1fb5baa43b693 Mon Sep 17 00:00:00 2001 From: Pierre Fenoll Date: Fri, 19 Apr 2019 13:31:04 +0200 Subject: [PATCH 3/3] lets stay pipey Signed-off-by: Pierre Fenoll --- lib/scribe.ex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/scribe.ex b/lib/scribe.ex index 0c4fc2b..2c94d33 100644 --- a/lib/scribe.ex +++ b/lib/scribe.ex @@ -75,12 +75,12 @@ defmodule Scribe do +----------+---------+ :ok """ - @spec print(IO.device(), data, format_opts) :: :ok - def print(dev \\ :stdio, _results, opts \\ []) + @spec print(data, IO.device(), format_opts) :: :ok + def print(_results, dev \\ :stdio, opts \\ []) - def print(_dev, [], _opts), do: :ok + def print([], _dev, _opts), do: :ok - def print(dev, results, opts) do + def print(results, dev, opts) do results |> format(opts) |> IO.puts(dev)