From 3addd3d3a220f512ee72bbfbd7e811592c8461d6 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Wed, 25 May 2022 15:10:08 -0700 Subject: [PATCH] [zsh] Move the hello message to its own Darwin-specific say_hello function --- zsh/func/init_profile_darwin | 10 ++-------- zsh/func/init_profile_darwin_say_hello | 13 +++++++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 zsh/func/init_profile_darwin_say_hello diff --git a/zsh/func/init_profile_darwin b/zsh/func/init_profile_darwin index 6798c45..cabb575 100644 --- a/zsh/func/init_profile_darwin +++ b/zsh/func/init_profile_darwin @@ -5,11 +5,5 @@ if ssh-add --apple-load-keychain; then echo fi -if binary_exists sw_vers; then - cat_program=cat - if binary_exists lolcat; then - cat_program=lolcat - fi - print "It's `date +'%H:%M on %A, %B %d'`.\nThis machine is a $HWMODEL.\nYou're running macOS $OSVERSION.\n" | $cat_program -fi - +autoload -Uz init_profile_darwin_say_hello +init_profile_darwin_say_hello diff --git a/zsh/func/init_profile_darwin_say_hello b/zsh/func/init_profile_darwin_say_hello new file mode 100644 index 0000000..d314013 --- /dev/null +++ b/zsh/func/init_profile_darwin_say_hello @@ -0,0 +1,13 @@ +#!/usr/bin/env zsh +# Eryn Wells + +if binary_exists sw_vers && [[ -n "$HWMODEL" && -n "$OSVERSION" ]]; then + cat_program=cat + if binary_exists lolcat; then + cat_program=lolcat + fi + print "It's `date +'%H:%M on %A, %B %d'`.\nThis machine is a $HWMODEL.\nYou're running macOS $OSVERSION.\n" | $cat_program + return 0 +fi + +return 1