lib/mix/tasks/relay*: Use a with block

Tento commit je obsažen v:
Haelwenn (lanodan) Monnier 2018-11-10 15:53:37 +01:00
rodič 12ccf0c4f8
revize 44b6200103
V databázi nebyl nalezen žádný známý klíč pro tento podpis
ID GPG klíče: D5B7A8E43C997DEE
2 změnil soubory, kde provedl 4 přidání a 8 odebrání

Zobrazit soubor

@ -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

Zobrazit soubor

@ -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