This commit is contained in:
Ray Elliott 2023-09-17 18:52:09 +01:00
parent b3cc2196f6
commit 5d4f6daef9
1 changed files with 86 additions and 3 deletions

89
bashrc
View File

@ -1,8 +1,88 @@
_WHITE='\033[1;37m' # White
_NC='\033[0m' # No Color
export SHELL_CONFIG="$SHELL_CONFIG:.bashrc"
#
# ~/.bashrc
#
function show_date() {
# Define an array of adjectives with classifications
adjectives=(
"beautiful:positive"
"engaging:positive"
"majestic:positive"
"distinguished:positive"
"venerable:positive"
"formal:positive"
"elegant:positive"
"serene:positive"
"graceful:positive"
"regal:positive"
"noble:positive"
"miserable:negative"
"worthless:negative"
"depressing:negative"
"soulless:negative"
"desolate:negative"
"archaic:negative"
"grim:negative"
"dreadful:negative"
"forlorn:negative"
"wretched:negative"
"neutral:neutral"
"ordinary:neutral"
"common:neutral"
"antique:neutral"
"ceremonial:neutral"
"timeless:neutral"
"classic:neutral"
"historic:neutral"
"ancient:neutral"
)
# Select a random adjective from the array
selected_adjective="${adjectives[$RANDOM % ${#adjectives[@]}]}"
# Split the selected adjective into the adjective and classification parts
IFS=':' read -r adjective classification <<< "$selected_adjective"
# Determine the color code based on the classification
case "$classification" in
"positive") text_color="\033[1;32m";;
"negative") text_color="\033[1;31m";;
*) text_color="";; # Default to no colour
esac
# ANSI escape codes for reset
reset_color='\033[0m'
hl_color='\033[1;34m'
# Get the current day of the week, day of the month, and year
day_of_week=$(date "+%A")
day_of_month=$(date "+%d")
month_name=$(date "+%B")
year=$(date "+%Y")
# Determine the day suffix (th, nd, rd)
case "$day_of_month" in
1[0-9]) day_suffix="th";;
*1) day_suffix="st";;
*2) day_suffix="nd";;
*3) day_suffix="rd";;
*) day_suffix="th";;
esac
# Create the full date format with colored parts and the selected adjective
full_date="Pray, be informed, on this ${text_color}${adjective}${reset_color} day, ${hl_color}${day_of_week}${reset_color} the ${hl_color}${day_of_month}${day_suffix}${reset_color} day of ${hl_color}${month_name}${reset_color}, in the year of our Lord ${hl_color}${year}${reset_color}!"
# Print the full date
echo -e "$full_date"
echo ""
}
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
@ -19,6 +99,8 @@ bind "set show-all-if-ambiguous on"
# cycling full results on the second Tab press (from bash version 5)
bind "set menu-complete-display-prefix on"
show_date;
source ~/.profile
export NVM_DIR="$HOME/.nvm"
@ -35,7 +117,7 @@ _updates_available="$(wc -l $HOME/.checkupdates | cut -d' ' -f1)"
[ -z $_updates_available ] && _updates_available="0"
echo "Remember your commands:"
echo " cheat vimv 'flameshot gui' mid3v2 zathura tesseract remmina"
echo -e " ${_WHITE}cheat vimv 'flameshot gui' mid3v2 zathura tesseract remmina${_NC}"
echo ""
if [ ${_mem_available%.*} -lt 5 ] ; then
@ -46,13 +128,15 @@ if [ ${_mem_available%.*} -lt 5 ] ; then
fi
if [ $_updates_available -gt 0 ] ; then
echo -n "Updates available: "
echo -ne "Updates available: \033[1;37m"
[ $_updates_available -gt 15 ] && echo -ne "\033[0;33m"
[ $_updates_available -gt 29 ] && echo -ne "\033[0;31m"
echo -ne "$_updates_available\033[0m"
echo ""
fi
echo ""
echo -e "Remember \"\033[1;34mTODO.md\033[0m\" files have content automatically displayed."
echo ""
. "$HOME/.config/bash/cheat.bash"
@ -115,4 +199,3 @@ random-bg() {
echo "#$color"
xsetroot -solid "#$color"
}