- Log ----------------------------------------------------------------- commit 143135e666f5564240868810f0b8f4bc46ff87b5 Author: Chantry Xavier <shiningxc@gmail.com> Date: Tue Feb 19 00:44:09 2008 +0100
Improve yesno function.
Add a preset paramater to yesno function saying which answer should be the default. Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-June/008470.html
This allows us to answer no by default to some questions, like the -Scc one mentioned in the above thread, and implemented by this patch.
Another advantage is that we don't have to repeat the [Y/n] in every questions. It's only put once in yesno function. This highly reduces the chances that YES and NO strings are translated, but not some questions, which lead to obvious confusions.
Finally, the noconfirm variable only needs to be used in that yesno function. So all other usages of it were removed.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Basically I like this change. 1. However, I don't see why -Scc needs different treatment from others: why is -Scc more dangerous than "remove whole content?"? <- -Scc needs explicit parameters in command-line, while '-R group' is kind an implicit stuff imho. 2. The last "fallback" 'return(0)' of yesno is also confusing: If I accidentally type 't' instead of 'y' then -Scc still will clean-up the whole cache. 3. To be honest I don't know whether return(preset) or return(!preset) is better, because I couldn't figure out the current principle of this default/fallback/noconfirm yesno stuff. My suggestion: If I define --noconfirm as "pacman presses Enter ;-)", then default return == noconfirm return (this is done). And in my opinion fallback return should indicate an error (-1) or question-repeat, because pacman shouldn't decide instead of me in case of typo. Bye ---------------------------------------------------- SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu This mail sent through IMP: http://horde.org/imp/