clearus/clearus
2024-12-14 11:00:10 +00:00

93 lines
1.9 KiB
Bash

#!/bin/bash
# Dedicated to my friend Clearus. Thanks for unblocking me fam! Also me and leafus are JUST FRIENDS. JUST FRIENDS...
#!/bin/bash
RESTORE='\033[0m'
HBLACK='\e[1;90m'
HRED='\e[1;91m'
HGREEN='\e[1;92m'
HYELLOW='\e[1;93m'
HBLUE='\e[1;94m'
HPURPLE='\e[1;95m'
HCYAN='\e[1;96m'
HWHITE='\e[1;97m'
# Get terminal size
height=$(tput lines)
width=$(tput cols)
# play BELL.
tput bel
clearus() {
# Clear the terminal
clear
# Ensure the 'yiff' directory is present and not empty
if [ ! -d "yiff" ] || [ -z "$(ls -A yiff 2>/dev/null)" ]; then
echo "Error: 'yiff' directory is missing or empty."
exit 1
fi
# Select a random image from the directory
yiff=$(find yiff -type f | shuf -n 1)
# Check if jp2a is installed
if ! command -v jp2a &>/dev/null; then
echo "Error: jp2a is not installed. Install it and try again."
exit 1
fi
# Display the image
jp2a --colors "$yiff" --size=${width}x${height}
}
version() {
printf "\n |\__/,| ( \n _.|o o |_ ) )\n-(((---(((--------\n\u2665$HRED Clearus v1.0\n$RESTORE\u2665 Developed by ${HCYAN}theridev$RESTORE (https://github.com/theridev)\nDedicated to Clearus: get fucked :3\n\n"
}
# Parse arguments
while [[ $# -gt 0 ]]; do
case "$1" in
help)
echo "Spierdalaj czarnuhu :3"
exit 0
;;
version | --version)
version
exit 0
;;
--height)
if [[ -n $2 ]]; then
height=$2
shift
else
echo -e "$HRED ERROR: Argument for --height not provided.$RESTORE"
exit 1
fi
;;
--width)
if [[ -n $2 ]]; then
width=$2
shift
else
echo -e "$HRED ERROR: Argument for --width not provided.$RESTORE"
exit 1
fi
;;
*)
echo -e "$HRED ERROR: Unknown argument '$1'.$RESTORE"
exit 1
;;
esac
shift
done
# Call clearus once
clearus
# One more dedication.
# I DEDICATE THIS PROJECT TO U LEAFUS I LOVE YOUUUUU (platonically)
# coding this on a VC was an awesome experience.