mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-25 02:19:31 +00:00
25 lines
631 B
Elixir
25 lines
631 B
Elixir
defmodule Mix.Tasks.Pleroma.Common do
|
|
@doc "Common functions to be reused in mix tasks"
|
|
def start_pleroma do
|
|
Mix.Task.run("app.start")
|
|
end
|
|
|
|
def get_option(options, opt, prompt, defval \\ nil, defname \\ nil) do
|
|
Keyword.get(options, opt) ||
|
|
case Mix.shell().prompt("#{prompt} [#{defname || defval}]") do
|
|
"\n" ->
|
|
case defval do
|
|
nil -> get_option(options, opt, prompt, defval)
|
|
defval -> defval
|
|
end
|
|
|
|
opt ->
|
|
opt |> String.trim()
|
|
end
|
|
end
|
|
|
|
def escape_sh_path(path) do
|
|
~S(') <> String.replace(path, ~S('), ~S(\')) <> ~S(')
|
|
end
|
|
end
|