Procházet zdrojové kódy

add common.ex

tags/v0.9.9
Rin Toshaka před 5 roky
rodič
revize
1d11c4cf11
1 změnil soubory, kde provedl 24 přidání a 0 odebrání
  1. +24
    -0
      lib/mix/tasks/pleroma/common.ex

+ 24
- 0
lib/mix/tasks/pleroma/common.ex Zobrazit soubor

@@ -0,0 +1,24 @@
defmodule Mix.Tasks.Pleroma.Common do
@shortdoc "Common functions to be reused in mix tasks"
def start_pleroma do
Mix.Task.run("app.start")
end

def get_option(options, opt, prompt, def \\ nil, defname \\ nil) do
Keyword.get(options, opt) ||
case Mix.shell().prompt("#{prompt} [#{defname || def}]") do
"\n" ->
case def do
nil -> get_option(options, opt, prompt, def)
def -> def
end

opt ->
opt |> String.trim()
end
end

def escape_sh_path(path) do
~S(') <> String.replace(path, ~S('), ~S(\')) <> ~S(')
end
end

Načítá se…
Zrušit
Uložit