1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Mix.Tasks.Pleroma.Common do
6 @doc "Common functions to be reused in mix tasks"
8 Mix.Task.run("app.start")
11 def get_option(options, opt, prompt, defval \\ nil, defname \\ nil) do
12 Keyword.get(options, opt) ||
13 case Mix.shell().prompt("#{prompt} [#{defname || defval}]") do
16 nil -> get_option(options, opt, prompt, defval)
25 def escape_sh_path(path) do
26 ~S(') <> String.replace(path, ~S('), ~S(\')) <> ~S(')