From 9cbf75f5992eb57343fb9cb3eec9e6fa2a9df08d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sun, 7 May 2017 19:02:22 +0200 Subject: Revert simplifications but add force option --- utils/inst | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'utils/inst') diff --git a/utils/inst b/utils/inst index 4d44cdf..e0a490e 100644 --- a/utils/inst +++ b/utils/inst @@ -2,9 +2,14 @@ # vim: ft=sh ask() { - echo -ne "\e[1;34m$1 (Y/n) \e[0m" - read - [[ $REPLY =~ ^[Yy]?$ ]] + if $FORCE; then + echo -ne "\e[1;34m$1\e[0m" + # Fall trough with 0 exit (always yes) + else + echo -ne "\e[1;34m$1? (Y/n) \e[0m" + read + [[ $REPLY =~ ^[Yy]?$ ]] + fi } dodiff() { @@ -25,7 +30,11 @@ dodiff() { echo -e "\e[1;32mNo difference detected:\e[0m $OUT" return fi - vimdiff "$1" "$OUT" + if $FORCE; then + doinst "$1" "$OUT" + else + vimdiff "$1" "$OUT" + fi } checkdiff() { -- cgit v1.2.3