2 # %x: name of file containing code being executed
3 local fortunes_dir="${${(%):-%x}:h}/fortunes"
6 alias chuck="fortune -a $fortunes_dir"
7 alias chuck_cow="chuck | cowthink"
9 # Automatically generate or update Chuck's compiled fortune data file
10 if [[ "$fortunes_dir/chucknorris" -ot "$fortunes_dir/chucknorris.dat" ]]; then
14 # For some reason, Cygwin puts strfile in /usr/sbin, which is not on the path by default
15 local strfile="${commands[strfile]:-/usr/sbin/strfile}"
16 if [[ ! -x "$strfile" ]]; then
17 echo "[oh-my-zsh] chucknorris depends on strfile, which is not installed" >&2
18 echo "[oh-my-zsh] strfile is often provided as part of the 'fortune' package" >&2
22 # Generate the compiled fortune data file
23 $strfile "$fortunes_dir/chucknorris" "$fortunes_dir/chucknorris.dat" >/dev/null