[pacman-dev] [PATCH 2/5] pacdiff: allow multiple separated options

Jonathan Frazier eyeswide at gmail.com
Tue Jul 16 14:00:18 EDT 2013


loop over arguments, this will allow adding options such as --nocolor

Signed-off-by: Jonathan Frazier <eyeswide at gmail.com>
---
 contrib/pacdiff.sh.in | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/contrib/pacdiff.sh.in b/contrib/pacdiff.sh.in
index 830e852..52a2e7e 100644
--- a/contrib/pacdiff.sh.in
+++ b/contrib/pacdiff.sh.in
@@ -63,8 +63,8 @@ cmd() {
 	fi
 }
 
-if [ $# -gt 0 ]; then
-	case $1 in
+while [[ -n "$1" ]]; do	
+	case "$1" in
 		-l|--locate)
 		locate=1;;
 		-V|--version)
@@ -74,7 +74,8 @@ if [ $# -gt 0 ]; then
 		*)
 		usage; exit 1;;
 	esac
-fi
+	shift
+done
 
 # see http://mywiki.wooledge.org/BashFAQ/020
 while IFS= read -u 3 -r -d '' pacfile; do
-- 
1.8.3.2



More information about the pacman-dev mailing list