Packages

A collection of tasks that help you install, update and teardown package managers and other things useful for your dotfiles. It's something like a meta package manager (package manager is the wrong word... still searching for a better one).

Current section

Files

Jump to
eisegesis lib mix tasks down.ex
Raw

lib/mix/tasks/down.ex

defmodule Mix.Tasks.Eise.Down do
@moduledoc """
Handles all uninstallations
"""
use Mix.Task
alias Eisegesis.Output
import Eisegesis.Executor
@passengers ["dotfiles", "repos", "yarn", "homebrew", "asdf", "shell"]
def run(args \\ []) do
start_section("GOODBYE FROM EISEGESIS!")
args
|> parse_args()
|> get_path_for()
|> Toml.decode_file!()
|> Task.async_stream(&each_module/1)
|> Enum.into([])
end
defp parse_args(args) do
{[{_, dir}], _} = OptionParser.parse!(args, strict: [setup_dir: :string])
dir
end
defp each_module({module, opts}) when module in @passengers do
module =
["elixir", "eisegesis", "passenger", module]
|> Enum.map(&String.capitalize/1)
|> Enum.join(".")
|> String.to_atom()
apply(module, :down, [opts])
end
defp each_module(_),
do: Output.error("There's a error on your `setup.toml` file", "unable to parse `setup.toml`")
end