[pacman-dev] Fwd: [PATCH] pacdiff: do not remove pacfile after viewing, but ask user
Vasiliy Korchagin
vasiliy.korchagin at gmail.com
Sun Nov 17 03:15:41 EST 2013
On 16.11.2013 15:11, Florian Pritz wrote:
> On 16.11.2013 11:44, Vasiliy Korchagin wrote:
>> I often use pacdiff tool for updating config files. And I find it very
>> inconvenient that after viewing files in vimdiff, I have the only choice
>> to delete pacfile. It would be more useful to ask user what to do next
>> with standard set of choices (view, skip, remove, overwrite).
>
> Looks good. Maybe also print the option string again (I'm never sure if
> removing is r or d (for delete)) and possibly also the filenames so it's
> easier to see what exactly is going to happen.
>
> We are dealing with system config files mostly so I think a little extra
> verbosity about what's going to happen never hurts. Especially
> considering that overwriting and removing don't ask for confirmation.
>
>> One line patch is attached.
>
> Please use git-send-email in the future so we can comment inline (most
> clients strip the attachment when replying otherwise). Not needed here,
> but very useful for larger patches.
We can print the same option string again, so session will look like:
# pacdiff
==> pacnew file found for /etc/dhcpcd.conf
:: (V)iew, (S)kip, (R)emove pacnew, (O)verwrite with pacnew: [v/s/r/o] v
:: (V)iew, (S)kip, (R)emove pacnew, (O)verwrite with pacnew: [v/s/r/o]
---
contrib/pacdiff.sh.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/pacdiff.sh.in b/contrib/pacdiff.sh.in
index 1bad0e4..d8a0c60 100644
--- a/contrib/pacdiff.sh.in
+++ b/contrib/pacdiff.sh.in
@@ -178,7 +178,7 @@ while IFS= read -u 3 -r -d '' pacfile; do
o|O) mv -v "$pacfile" "$file"; break ;;
v|V)
$diffprog "$pacfile" "$file"
- rm -iv "$pacfile"; break ;;
+ ask "(V)iew, (S)kip, (R)emove %s, (O)verwrite with %s, (Q)uit:
[v/s/r/o/q] " "$file_type" "$file_type"; continue ;;
s|S) break ;;
*) ask "Invalid answer. Try again: [v/s/r/o/q] "; continue ;;
esac
-- 1.8.4.2
More information about the pacman-dev
mailing list