aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>2018-11-10 15:53:37 +0100
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>2018-11-17 22:12:13 +0100
commit44b6200103d52ab86b46f8b4b9e0768036184d05 (patch)
treeb2d3702fe2393233a0badd5a0c907d3a773d1d42
parent12ccf0c4f835cee1e942e13482322b0d9a5e7c2d (diff)
downloadpleroma-44b6200103d52ab86b46f8b4b9e0768036184d05.tar.gz
lib/mix/tasks/relay*: Use a with block
-rw-r--r--lib/mix/tasks/relay_follow.ex6
-rw-r--r--lib/mix/tasks/relay_unfollow.ex6
2 files changed, 4 insertions, 8 deletions
diff --git a/lib/mix/tasks/relay_follow.ex b/lib/mix/tasks/relay_follow.ex
index bec63af7c..85b1c024d 100644
--- a/lib/mix/tasks/relay_follow.ex
+++ b/lib/mix/tasks/relay_follow.ex
@@ -14,13 +14,11 @@ defmodule Mix.Tasks.RelayFollow do
def run([target]) do
Mix.Task.run("app.start")
- {status, message} = Relay.follow(target)
-
- if :ok == status do
+ with {:ok, activity} <- Relay.follow(target) do
# put this task to sleep to allow the genserver to push out the messages
:timer.sleep(500)
else
- Mix.puts("Error: #{inspect(message)}")
+ {:error, e} -> Mix.shell().error("Error while following #{target}: #{inspect(e)}")
end
end
end
diff --git a/lib/mix/tasks/relay_unfollow.ex b/lib/mix/tasks/relay_unfollow.ex
index df719af2b..237fb771c 100644
--- a/lib/mix/tasks/relay_unfollow.ex
+++ b/lib/mix/tasks/relay_unfollow.ex
@@ -13,13 +13,11 @@ defmodule Mix.Tasks.RelayUnfollow do
def run([target]) do
Mix.Task.run("app.start")
- {status, message} = Relay.unfollow(target)
-
- if :ok == status do
+ with {:ok, activity} <- Relay.follow(target) do
# put this task to sleep to allow the genserver to push out the messages
:timer.sleep(500)
else
- Mix.puts("Error: #{inspect(message)}")
+ {:error, e} -> Mix.shell().error("Error while following #{target}: #{inspect(e)}")
end
end
end