# -*-eselect-*- vim: ft=eselect # Copyright 2005-2013 Gentoo Foundation # Distributed under the terms of the GNU GPL version 2 or later DESCRIPTION="Do things to a cow" MAINTAINER="eselect@gentoo.org" ### moo action describe_moo() { echo "Say moo" } describe_moo_parameters() { echo "" } describe_moo_options() { echo "text : Text to display (optional)" echo "--dead : Use a dead cow" echo "--borg : Use a borged cow" } do_moo() { local params= while [[ ${1#--} != ${1} ]] ; do if [[ "--dead" == ${1} ]] ; then shift params="${params} -d" elif [[ "--borg" == "${1}" ]] ; then shift params="${params} -b" elif [[ "--" == "${1}" ]] ; then break else die -q "Unknown parameter ${1}" fi done echo "${@:-I am a cow}" | cowsay ${params} } ### think action describe_think() { echo "Show a pensive cow" } describe_think_parameters() { echo "" } describe_think_options() { echo "text : Text to display" echo "--sheep : Use a sheep rather than a cow" } do_think() { local params= while [[ ${1#--} != ${1} ]] ; do if [[ "--sheep" == ${1} ]] ; then shift params="${params} -f sheep" elif [[ "--" == "${1}" ]] ; then break else die -q "Unknown parameter ${1}" fi done echo "${@:-Am I a cow?}" | cowthink ${params} }