lib/mix/tasks/needle.new.ctx.ex
defmodule Mix.Tasks.Needle.New.Ctx do
@moduledoc """
Creates a new context project within an umbrella project.
It expects the command to be run inside an umbrella application's
`apps` directory:
$ cd my_umbrella/apps
$ mix needle.new.ctx PATH [--app APP] [--module MODULE]
This task is intended to create a bare context project without web
integration, which serves as a core application of your domain.
## Options
It supports the same options as the `needle.new` task.
See `mix help needle.new` for details.
## Examples
$ mix needle.new.ctx hello_ctx
"""
@shortdoc "Creates a new context project within an umbrella project"
use Mix.Task
alias Needle.New
alias Needle.New.Generators.Ctx
@impl true
def run([base_path | _] = argv) do
unless Needle.New.Generator.in_umbrella?(base_path) do
Mix.raise("The task can only be run within an umbrella's apps directory")
end
New.run(__MODULE__, argv, Ctx)
end
end