Skip to content

Commit

Permalink
Make the "cow" for chuck norris random
Browse files Browse the repository at this point in the history
  • Loading branch information
ttelford committed Jun 26, 2024
1 parent 09637ae commit 36812e7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugins/chucknorris/chucknorris.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
# %x: name of file containing code being executed
local fortunes_dir="${${(%):-%x}:h}/fortunes"

local -a COWS=($(cowsay -l | tail -n+2 | tr '\n' ' '))
local -a EXCLUDED_COWS=("Example" "MechAndCow" "Frogs" "TextBalloon" "TuxStab" "sodomized" "telebears")
COWS=(${COWS:|EXCLUDED_COWS})
local RANDCOW=${COWS[$(($RANDOM % ${#COWS[@]}))]}

# Aliases
alias chuck="fortune -a $fortunes_dir"
alias chuck_cow="chuck | cowthink"
alias chuck_cow="chuck | cowthink -W 75 -f ${RANDCOW}"

# Automatically generate or update Chuck's compiled fortune data file
if [[ "$fortunes_dir/chucknorris" -ot "$fortunes_dir/chucknorris.dat" ]]; then
Expand Down

0 comments on commit 36812e7

Please sign in to comment.