How to `--no-confirm` mix phx tasks?

Hello everybody, how do I run something like mix phx.gen.html Abc abc --no-confirm?

What happens without --no-confirm

You are generating into an existing context.

...

  * It's OK to have multiple resources in the same context as long as they are closely related. But if a context grows too large, consider breaking it apart

  * If they are not closely related, another context probably works better

The fact two entities are related in the database does not mean they belong to the same context.

If you are not sure, prefer creating a new context over adding to the existing one.

Would you like to proceed? [Yn] 

I don’t want to get a prompt. Is there any workarounds?

If you are on linux you maybe have yes on your path, not sure if its a debian thing
You can pipe it into mix like so yes | mix phx.gen.html Abc abc

Not the most elegant solution but it works

There was a reply here before, which hinted at this resulting in a deadlock. This might not be as safe as described.

1 Like