Add the possibility to create profiles and groups from CLI

- Create an actor at the same time when creating an user
- or create either a profile and attach it to an existing user
- or create a group and set the admin to an existing profile

Closes #785

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-07-20 18:22:18 +02:00
parent debcdaeed8
commit 11e75eaf66
7 changed files with 479 additions and 7 deletions

View File

@@ -62,10 +62,16 @@ defmodule Mix.Tasks.Mobilizon.Common do
end
@spec shell_error(String.t()) :: :ok
def shell_error(message) do
if mix_shell?(),
do: Mix.shell().error(message),
else: IO.puts(:stderr, message)
def shell_error(message, options \\ []) do
if mix_shell?() do
Mix.shell().error(message)
else
IO.puts(:stderr, message)
end
if Application.fetch_env!(:mobilizon, :env) != :test do
exit({:shutdown, Keyword.get(options, :error_code, 1)})
end
end
@doc "Performs a safe check whether `Mix.shell/0` is available (does not raise if Mix is not loaded)"