mirror of
https://github.com/ash-project/igniter.git
synced 2024-09-19 13:02:51 +12:00
improvement: add --with-args
to pass additional args to installers
This commit is contained in:
parent
4d80d01be5
commit
785cff06e4
1 changed files with 15 additions and 4 deletions
|
@ -9,6 +9,11 @@ defmodule Mix.Tasks.Igniter.New do
|
||||||
* `--install` - A comma-separated list of dependencies to install using `mix igniter.install` after creating the project.
|
* `--install` - A comma-separated list of dependencies to install using `mix igniter.install` after creating the project.
|
||||||
* `--example` - Request example code to be added to the project when installing packages.
|
* `--example` - Request example code to be added to the project when installing packages.
|
||||||
* `--with` - The command to use instead of `new`, i.e `phx.new`
|
* `--with` - The command to use instead of `new`, i.e `phx.new`
|
||||||
|
* `--with-args` - Additional arguments to pass to the installer provided in `--with`
|
||||||
|
|
||||||
|
Example
|
||||||
|
|
||||||
|
mix igniter.new my_project --install foo,bar,baz --with=phx.new --with-args="--no-ecto"
|
||||||
"""
|
"""
|
||||||
@shortdoc "Creates a new Igniter application"
|
@shortdoc "Creates a new Igniter application"
|
||||||
use Mix.Task
|
use Mix.Task
|
||||||
|
@ -39,10 +44,16 @@ defmodule Mix.Tasks.Igniter.New do
|
||||||
"The first positional argument must be a project name that starts with a dash, got: #{name}"
|
"The first positional argument must be a project name that starts with a dash, got: #{name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
{options, argv, _errors} =
|
{options, _argv, _errors} =
|
||||||
OptionParser.parse(argv,
|
OptionParser.parse(argv,
|
||||||
strict: [install: :keep, local: :string, example: :boolean, with: :string],
|
strict: [
|
||||||
aliases: [i: :install, l: :local, e: :example, w: :with]
|
install: :keep,
|
||||||
|
local: :string,
|
||||||
|
example: :boolean,
|
||||||
|
with: :string,
|
||||||
|
with_args: :string
|
||||||
|
],
|
||||||
|
aliases: [i: :install, l: :local, e: :example, w: :with, wa: :with_args]
|
||||||
)
|
)
|
||||||
|
|
||||||
install_with = options[:with] || "new"
|
install_with = options[:with] || "new"
|
||||||
|
@ -68,7 +79,7 @@ defmodule Mix.Tasks.Igniter.New do
|
||||||
exit({:shutdown, 1})
|
exit({:shutdown, 1})
|
||||||
end
|
end
|
||||||
|
|
||||||
Mix.Task.run(install_with, [name | argv])
|
Mix.Task.run(install_with, [name | OptionParser.split(options[:with_args] || "")])
|
||||||
|
|
||||||
version_requirement =
|
version_requirement =
|
||||||
if options[:local] do
|
if options[:local] do
|
||||||
|
|
Loading…
Reference in a new issue