debianize-mobilizon/lib/mix/tasks/mobilizon/toot.ex
Thomas Citharel c3cca5d613
Fix credo style reports following it's update
Mainly transform `with` into `case`

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2019-07-23 18:12:26 +02:00

25 lines
514 B
Elixir

defmodule Mix.Tasks.Mobilizon.Toot do
@moduledoc """
Creates a bot from a source
"""
use Mix.Task
require Logger
@shortdoc "Toot to an user"
def run([from, content]) do
Mix.Task.run("app.start")
case MobilizonWeb.API.Comments.create_comment(from, content) do
{:ok, _} ->
Mix.shell().info("Tooted")
{:local_actor, _} ->
Mix.shell().error("Failed to toot.\nActor #{from} doesn't exist")
_ ->
Mix.shell().error("Failed to toot.")
end
end
end