2022-05-25 15:10:08 -07:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
# Eryn Wells <eryn@erynwells.me>
|
|
|
|
|
2022-05-26 08:54:31 -07:00
|
|
|
autoload -Uz binary_exists
|
|
|
|
|
|
|
|
if binary_exists sw_vers && [[ -n "$HWMODEL" && -n "$OSVERSION" && -n "$OSBUILD" ]]; then
|
2022-05-25 15:10:08 -07:00
|
|
|
cat_program=cat
|
|
|
|
if binary_exists lolcat; then
|
|
|
|
cat_program=lolcat
|
|
|
|
fi
|
2022-05-26 08:54:31 -07:00
|
|
|
|
|
|
|
local hello_message="It's `date +'%H:%M on %A, %B %d'`."
|
|
|
|
|
|
|
|
if [[ -n "$HWMODEL" ]]; then
|
|
|
|
hello_message+="\nThis machine is a $HWMODEL."
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "$OSVERSION" ]]; then
|
|
|
|
if [[ -n "$OSBUILD" ]]; then
|
|
|
|
hello_message+="\nYou're running macOS $OSVERSION ($OSBUILD)."
|
|
|
|
else
|
|
|
|
hello_message+="\nYou're running macOS $OSVERSION."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
print "$hello_message\n" | $cat_program
|
|
|
|
|
2022-05-25 15:10:08 -07:00
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 1
|