git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH Cogito] Improve option parsing for cg-log
@ 2005-05-12 20:51 Marcel Holtmann
  2005-05-12 21:13 ` Petr Baudis
  0 siblings, 1 reply; 7+ messages in thread
From: Marcel Holtmann @ 2005-05-12 20:51 UTC (permalink / raw)
  To: Petr Baudis; +Cc: GIT Mailing List

[-- Attachment #1: Type: text/plain, Size: 182 bytes --]

Hi Petr,

the attached patch changes the option parsing, because otherwise we are
stuck to a specific order.

Regards

Marcel


Signed-off-by: Marcel Holtmann <marcel@holtmann.org>


[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 1294 bytes --]

Index: cg-log
===================================================================
--- 456fffab323ed972b8e47fa0fb83c3b5cd9243d7/cg-log  (mode:100755)
+++ uncommitted/cg-log  (mode:100755)
@@ -27,29 +27,34 @@
 # at least somewhere it does. Bash is broken.
 trap exit SIGPIPE
 
-if [ "$1" = "-c" ]; then
-	shift
-	# See terminfo(5), "Color Handling"
-	colheader="$(tput setaf 2)"    # Green
-	colauthor="$(tput setaf 6)"    # Cyan
-	colcommitter="$(tput setaf 5)" # Magenta
-	colfiles="$(tput setaf 4)"     # Blue
-	colsignoff="$(tput setaf 3)"   # Yellow
-	coldefault="$(tput op)"        # Restore default
-else
-	colheader=
-	colauthor=
-	colcommitter=
-	colfiles=
-	colsignoff=
-	coldefault=
-fi
-
+colheader=
+colauthor=
+colcommitter=
+colfiles=
+colsignoff=
+coldefault=
 list_files=
-if [ "$1" = "-f" ]; then
-	shift
-	list_files=1
-fi
+while [ "$1" ]; do
+	case "$1" in
+	-c)
+		# See terminfo(5), "Color Handling"
+		colheader="$(tput setaf 2)"    # Green
+		colauthor="$(tput setaf 6)"    # Cyan
+		colcommitter="$(tput setaf 5)" # Magenta
+		colfiles="$(tput setaf 4)"     # Blue
+		colsignoff="$(tput setaf 3)"   # Yellow
+		coldefault="$(tput op)"        # Restore default
+		shift
+		;;
+	-f)
+		list_files=1
+		shift
+		;;
+	*)
+		break
+		;;
+	esac
+done
 
 list_commit_files()
 {

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-05-17 20:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-12 20:51 [PATCH Cogito] Improve option parsing for cg-log Marcel Holtmann
2005-05-12 21:13 ` Petr Baudis
2005-05-12 21:49   ` Marcel Holtmann
2005-05-13  5:41     ` Petr Baudis
2005-05-13  9:05       ` Marcel Holtmann
2005-05-17 20:16         ` Petr Baudis
2005-05-13 11:32       ` Dan Holmsand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).