diff options
author | Aaron Walker <ka0ttic@gentoo.org> | 2005-02-06 14:37:54 +0000 |
---|---|---|
committer | Aaron Walker <ka0ttic@gentoo.org> | 2005-02-06 14:37:54 +0000 |
commit | 23ba1debf1161b3ed6249201985411138ea269d9 (patch) | |
tree | cf93ea7a341a8b768471a14b9d64dd2ecbdb967e /games-misc/cowsay/files | |
parent | remove patch added upstream for beta2 (diff) | |
download | gentoo-2-23ba1debf1161b3ed6249201985411138ea269d9.tar.gz gentoo-2-23ba1debf1161b3ed6249201985411138ea269d9.tar.bz2 gentoo-2-23ba1debf1161b3ed6249201985411138ea269d9.zip |
Added cowsay command-line completion.
(Portage version: 2.0.51-r15)
Diffstat (limited to 'games-misc/cowsay/files')
-rw-r--r-- | games-misc/cowsay/files/cowsay.bashcomp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/games-misc/cowsay/files/cowsay.bashcomp b/games-misc/cowsay/files/cowsay.bashcomp new file mode 100644 index 000000000000..94860b240689 --- /dev/null +++ b/games-misc/cowsay/files/cowsay.bashcomp @@ -0,0 +1,35 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/games-misc/cowsay/files/cowsay.bashcomp,v 1.1 2005/02/06 14:37:54 ka0ttic Exp $ + +# bash command-line completion for cowsay +# Author: Aaron Walker <ka0ttic@gentoo.org> + +_cowsay() { + local cur prev opts x + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="-e -f -h -l -n -T -W -b -d -g -p -s -t -w -y" + + if [[ "${cur}" == -* || ${COMP_CWORD} -eq 1 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi + + case "${prev}" in + -f) + COMPREPLY=($(compgen -f -- ${cur}) \ + $(compgen -W "$(\ + for x in /usr/share/cowsay-*/cows/*.cow ; do \ + [[ -f ${x} ]] && { local y=${x##*/} ; echo ${y%.*} ; } \ + done)" -- ${cur}) ) + ;; + -[eTW]) + COMPREPLY=() + ;; + esac +} +complete -o filenames -F _cowsay cowsay cowthink + +# vim: set ft=sh tw=80 sw=4 et : |