From 1d06f044ba0a2cfaff51aec1ee8dd13d666950c9 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Tue, 12 Oct 2021 15:08:01 -0500 Subject: [PATCH] Don't get in the user's way if cowsay isn't installed Signed-off-by: Thomas A. Christensen II <25492070+MillironX@users.noreply.github.com> --- cowsay-cows.plugin.zsh | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/cowsay-cows.plugin.zsh b/cowsay-cows.plugin.zsh index 316c460..2732f94 100644 --- a/cowsay-cows.plugin.zsh +++ b/cowsay-cows.plugin.zsh @@ -1,27 +1,21 @@ -# Only add stuff if cowsay is installed -if [ $(command -v cowsay) ]; then - # Add default install cows to COWPATH - # Search for cows in $PREFIX/share/cows. According to the original repo - # (https://github.com/tnalpgge/rank-amateur-cowsay), this is the place to find - # cowfiles. Arch, local builds (including Homebrew) and Android/Termux are the - # only distros to stick with this location afaik - COWPATH=$COWPATH:$(dirname $(dirname $(command -v cowsay)))/share/cows +# Add default install cows to COWPATH +# Search for cows in $PREFIX/share/cows. According to the original repo +# (https://github.com/tnalpgge/rank-amateur-cowsay), this is the place to find +# cowfiles. Arch, local builds (including Homebrew) and Android/Termux are the +# only distros to stick with this location afaik +COWPATH=$COWPATH:$(dirname $(dirname $(command -v cowsay)))/share/cows - # Add the oddball cowfile locations - COWPATH=$COWPATH:/usr/share/cowsay # RHEL/Fedora - COWPATH=$COWPATH:/usr/share/cowsay/cows # Debian/Ubuntu +# Add the oddball cowfile locations +COWPATH=$COWPATH:/usr/share/cowsay # RHEL/Fedora +COWPATH=$COWPATH:/usr/share/cowsay/cows # Debian/Ubuntu - # Add the plugin's cows to COWPATH - COWPATH=$(dirname $0):$COWPATH +# Add the plugin's cows to COWPATH +COWPATH=$(dirname $0):$COWPATH - # COWPATH complete! Use it! - export COWPATH +# COWPATH complete! Use it! +export COWPATH - # Create some fun aliases - alias bullsay="cowsay -f bull" - alias steersay="cowsay -f longhorn" - alias tuxsay="cowsay -f tux" -else - # Direct the user to install cowsay - alias cowsay="echo \"cowsay needs to be installed via apt, dnf, or the like\"" -fi +# Create some fun aliases +alias bullsay="cowsay -f bull" +alias steersay="cowsay -f longhorn" +alias tuxsay="cowsay -f tux"