From b9ffb87f1e84d688a98bca73c3a8c7b09204efe3 Mon Sep 17 00:00:00 2001 From: Charles Gould Date: Sun, 23 Feb 2020 23:15:31 -0500 Subject: [PATCH] fish: add Chuck Norris message-of-the-day --- fish/functions/motd.fish | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fish/functions/motd.fish b/fish/functions/motd.fish index c9fce05..2d5936a 100644 --- a/fish/functions/motd.fish +++ b/fish/functions/motd.fish @@ -1,6 +1,11 @@ -function motd - if not command --search --quiet fortune ; echo "Error: function requires fortune" ; return 1 ; end - if not command --search --quiet cowsay ; echo "Error: function requires cowsay" ; return 2 ; end - if not command --search --quiet lolcat ; echo "Error: function requires lolcat" ; return 3 ; end - fortune | cowsay | lolcat +function motd --description "Message of the day!" + set --local daily_msg + + if contains -- '--chuck-norris' $argv + set daily_msg (curl -s 'https://api.chucknorris.io/jokes/random' | jq --raw-output '.value') + else + set daily_msg (fortune) + end + + cowsay $daily_msg end