Packages

Use Elixir as a scripting language with Hex packages, anywhere on your system. No Mix project required!

Retired package: Renamed - renamed to Teex: https://hex.pm/packages/teex

Current section

Files

Jump to
tex lib mix tasks tex.create.ex
Raw

lib/mix/tasks/tex.create.ex

defmodule Mix.Tasks.Tex.Create do
use Mix.Task
alias Tex.Util
alias Tex.Types.Workspace
require Logger
def run(["workspace", name]) do
full_path = Util.compute_workspace_path(name)
if File.dir?(full_path) do
Logger.warn("Workspace #{name} already exists! Not creating it again.")
exit(0)
end
Logger.info("Creating a new workspace: #{name}")
File.mkdir_p!(full_path)
workspace = Workspace.build(
name: name,
path: full_path
)
{:ok, _} = Util.Configuration.save_workspace(workspace)
Logger.info("Workspace created!")
Logger.info("Name: #{name}")
Logger.info("Path: #{full_path}")
end
def run(_) do
IO.puts("Not sure what you mean!")
:ok
end
end