Skip to content

Commit

Permalink
change COW_FILE detection from OSTYPE to checking execution results
Browse files Browse the repository at this point in the history
  • Loading branch information
buzztaiki committed Apr 8, 2022
1 parent 93c23d8 commit 5f96567
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
13 changes: 5 additions & 8 deletions bin/unko.say
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ readonly THIS_DIR
LIB_DIR="${THIS_DIR}/../lib/super_unko"
readonly LIB_DIR

case ${OSTYPE} in
darwin*)
COW_FILE="${LIB_DIR}/unko_mb.cow"
;;
*)
COW_FILE="${LIB_DIR}/unko.cow"
;;
esac
COW_FILE="${LIB_DIR}/unko_mb.cow"
if ! (cowsay -f "${COW_FILE}" 'うんこ' | grep -qe 'うんこ' &&
cowsay -f "${COW_FILE}" 'もりもり' | grep -qe '💩'); then
COW_FILE="${LIB_DIR}/unko.cow"
fi

cowsay -f "${COW_FILE}" "$@"
13 changes: 5 additions & 8 deletions bin/unko.think
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ readonly THIS_DIR
LIB_DIR="${THIS_DIR}/../lib/super_unko"
readonly LIB_DIR

case ${OSTYPE} in
darwin*)
COW_FILE="${LIB_DIR}/unko_mb.cow"
;;
*)
COW_FILE="${LIB_DIR}/unko.cow"
;;
esac
COW_FILE="${LIB_DIR}/unko_mb.cow"
if ! (cowsay -f "${COW_FILE}" 'うんこ' | grep -qe 'うんこ' &&
cowsay -f "${COW_FILE}" 'もりもり' | grep -qe '💩'); then
COW_FILE="${LIB_DIR}/unko.cow"
fi

cowthink -f "${COW_FILE}" "$@"

0 comments on commit 5f96567

Please sign in to comment.