public inbox for gentoo-soc@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-soc] Yet another patch
@ 2010-04-09  6:29 Jan K
  0 siblings, 0 replies; only message in thread
From: Jan K @ 2010-04-09  6:29 UTC (permalink / raw
  To: gentoo-soc

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

Hi!
So... next patch and next greetings!
It seems that somebody added cowsay functionality to eselect - a fair,
mad idea ;-)
Instead of rather useless patch let's develop this further.
Regards,
Jan Kończak

[-- Attachment #2: cow.patch --]
[-- Type: application/octet-stream, Size: 1471 bytes --]

--- eselect/trunk/modules/cow.eselect.bak	2010-04-08 19:21:30.000000000 +0200
+++ eselect/trunk/modules/cow.eselect	2010-04-08 20:02:39.000000000 +0200
@@ -22,10 +22,15 @@
 	echo "text : Text to display (optional)"
 	echo "--dead : Use a dead cow"
 	echo "--borg : Use a borged cow"
+	echo "--transmoote <character> : Use character instead of a cow"
 }
 
 do_moo() {
+	if [ -z "$COWPATH" ]
+		then COWPATH=/usr/share/cowsay-3.03/cows
+	fi
 	local params=
+	local character=
 	while [[ ${1#--} != ${1} ]] ; do
 		if [[ "--dead" == ${1} ]] ; then
 			shift
@@ -33,6 +38,15 @@
 		elif [[ "--borg" == "${1}" ]] ; then
 			shift
 			params="${params} -b"
+		elif [[ "--transmoote" == "${1}" ]] ; then
+			shift
+			if [[ ! -f ${COWPATH}/${1}.cow ]]
+			then
+				die -q "Unknown character ${1}"
+			fi
+			character=${1}
+			params="${params} -f ${1}"
+			shift
 		elif [[ "--" == "${1}" ]] ; then
 			break
 		else
@@ -40,7 +54,7 @@
 		fi
 	done
 
-	echo "${@:-I am a cow}" | cowsay ${params}
+	echo "${@:-I am a ${character:-cow}}" | cowsay ${params}
 }
 
 ### think action
@@ -73,3 +87,22 @@
 
 	echo "${@:-Am I a cow?}" | cowthink ${params}
 }
+
+### list characters
+
+describe_list() {
+	echo "List available characters"
+}
+
+do_list() {
+	if [ -z "$COWPATH" ]
+		then COWPATH=/usr/share/cowsay-3.03/cows
+	fi
+
+	write_list_start "Available cowsay characters:"
+
+	write_numbered_list $(for moo in $(ls -1 $COWPATH/*.cow)
+		do echo $(basename $moo .cow)
+	done)
+
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-04-09  6:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-09  6:29 [gentoo-soc] Yet another patch Jan K

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox