commit a01f2cdb3c29ea680aad5bc1f0875e641ce6607e
parent dd397fc2c55f30c4f092ff6df68cd0167020fab2
Author: pyratebeard <root@pyratebeard.net>
Date: Tue, 14 Jul 2020 21:39:07 +0100
remove get_news from welcome script and replace with new greetings script
Diffstat:
2 files changed, 45 insertions(+), 12 deletions(-)
diff --git a/bin/bin/greetings b/bin/bin/greetings
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+
+email() {
+ local -r mail_dir="$HOME/lib/doc/email"
+
+ echo -e "\n\e[35m----pyratebeard mail\e[0m"
+ local -r pyratebeard_mail=$(ls -1 ${mail_dir}/pyratebeard/INBOX/new/ | wc -l)
+ echo -e "you have \e[1;32m${pyratebeard_mail}\e[0m new mail(s)"
+
+ echo -e "\n\e[35m-------octotech mail\e[0m"
+ local -r octotech_mail=$(ls -1 ${mail_dir}/octotech/INBOX/new/ | wc -l)
+ echo -e "you have \e[1;32m${octotech_mail}\e[0m new mail(s)"
+}
+
+# not currently used by keeping for future reference
+getnews() {
+ local -r api_key=$(pass websites/newsapi/key)
+ curl 'https://newsapi.org/v2/top-headlines' -s -G \
+ -d sources=$1 \
+ -d pageSize=5 \
+ -d apiKey="${api_key}" | jq -r 'def default: "\u001b[0m"; def grey: "\u001b[1;30m"; .articles[] | .title, grey + .url, "" + default' | tr -d '\t'
+}
+
+boats() {
+ if [ -f ~/.newsboat/cache.db.lock ] ; then
+ echo "\n\e[30mwaiting for newsboat refresh...\e[0m"
+ sleep 10
+ fi
+ local unread_count=$(sqlite3 ~/.newsboat/cache.db "select count(unread) from rss_item where unread = 1;")
+ local queued_pods=$(cat ~/.newsboat/queue | wc -l)
+ echo -e "\n\e[35m------------newsboat\e[0m"
+ echo -e "you have \e[1;32m${unread_count}\e[0m unread items"
+ echo -e "\n\e[35m-------------podboat\e[0m"
+ echo -e "you have \e[1;32m${queued_pods}\e[0m queued podcasts"
+}
+
+main() {
+ echo -e "\n\e[35m-----today's weather\e[0m"
+ curl "wttr.in/dublin?format=%l:+%f+%C\n"
+ email
+ boats
+}
+
+main
diff --git a/zsh/.zsh/welcome.zsh b/zsh/.zsh/welcome.zsh
@@ -13,13 +13,6 @@ audio_vol() {
fi
}
-getnews() {
- curl 'https://newsapi.org/v2/top-headlines' -s -G \
- -d sources=$1 \
- -d pageSize=5 \
- -d apiKey=$NEWS_API_KEY | jq -r '.articles[] | .title, .url, ""' | tr -d '\t'
-}
-
# script run on first terminal
script() {
cat ~/tmp/pyratebeard_ansi_md
@@ -27,11 +20,7 @@ script() {
audio_vol
tmux new -s main -n '~'
if [[ ${TMUX_PANE} == '%0' ]] ; then
- echo -e "\n// WELCOME $(whoami | tr 'a-z' 'A-Z')\n"
- echo -e "\nIRISH NEWS HEADLINES:"
- getnews the-irish-times
- echo -e "\nHACKER NEWS HEADLINES:"
- getnews hacker-news
+ ~/bin/greetings
fi
fi
}