How can I pass something like "--yes" to brew in order for it to avoid asking for confirmations?
There does not appear to be such a "--yes" parameter, nor something similar for the brew command.
You can consider doing something simple like running the following command:
yes | brew <...>
However be aware that this will answer "y" to everything automatically.