On 10/31/22 at 11:17pm, Laszlo Toth wrote:
This is intended for e.g., regular, automated cache clearing or updating/creating Docker images.
There is --noconfirm, but that selects the default answer for yes/no questions, which may be no when we want yes. Then 'yes | pacman -Scc' could be used, but that does not work reliably w/ multiselection. So, add a new option which always answers yes for yes/no, and the default for multiselections.
Now --confirm disables both --noconfirm and --noconfirm-unsafe.
noask is not updated to use this mode as well... it's not safe.
This has come up a number of times and I'm still not really a fan. Automation has never been a significant design goal for pacman and, even if we were to make it one, the shotgun approach is extremely inelegant, completely ignoring the needs of any scripts that require any level of specificity. That's a big part of why I wrote pacutils, which has advanced features for avoiding the situations that result in prompts and specific options for dealing with prompts when they are required. It even includes a --yolo option for people who simply insist on breaking things. https://github.com/andrewgregory/pacutils/blob/master/doc/pactrans.pod#promp... ...
@@ -1617,6 +1617,11 @@ int select_question(int count) fprintf(stream, ": "); fflush(stream);
+ if(config->noconfirmunsafe) { + fprintf(stream, "y\n");
This makes no sense, the user is selecting an item from a list. "y" is not a valid response. ...
@@ -1705,6 +1710,11 @@ static int question(short preset, const char *format, va_list args) fputs(config->colstr.nocolor, stream); fflush(stream);
+ if(config->noconfirmunsafe) { + fprintf(stream, "y\n"); + return preset;
You're still just returning the default, what is noconfirm-unsafe actually doing?