portmaster -afdy --no-confirm
It's generally good practice to peruse the man page.
Specifically, this tidbit
do not ask the user to confirm the list of ports to be installed
and/or updated before proceeding
Unfortunately, , this is not always sufficient, especially if certain packages ask for a prompt independently.
There is another flag,
-y that answers yes to all prompts, depending on the version of
portmaster it may be there, but it is absent in the FreeBSD version of the man page.
But from the horses mouth
echo '-y answer yes to all user prompts for the features below'
This is actually quite common for interactive console applications across the *NIX world, so
-y is usually worth a try.
Generically, in other situations,
yes is a standard shell utility that will spam "yes", or any other string to a shell.
yes | portmaster -af
yes no | portmaster -af
to refuse everything.