Search code examples
inputphoenix-frameworkpromptelixir-mix

Automatically supply yes to phx.new prompts


I'm running this containerized instance of Phoenix.

The documentation says the following command can be run, but gives the error:

root@890ba3f1be37:/code# mix phx.new hello -y
** (Mix) Invalid option: -y

The environmental details are:

root@890ba3f1be37:/code# mix --version
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:10] [kernel-poll:false]

Mix 1.5.2
root@890ba3f1be37:/code# elixir --version
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:10] [kernel-poll:false]

Elixir 1.5.2
root@890ba3f1be37:/code# mix phx.new --version
Phoenix v1.3.0

Am I missing something here?


Solution

  • I believe the documentation is incorrect as the mix task unconditionally calls Mix.shell.yes?. You can instead pipe echo yes into mix phx.new ... to automatically respond to the prompt with yes.

    echo yes | mix phx.new foo