Ensure the `clear` command runs only in interactive shells with a valid terminal, preventing unintended behavior in non-interactive environments.
38 lines
1,000 B
Bash
38 lines
1,000 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
if [ -n "${BASH_VERSION-}" ]; then script_path="${BASH_SOURCE[0]}"
|
|
elif [ -n "${ZSH_VERSION-}" ]; then script_path="${(%):-%x}"
|
|
else script_path="$0"
|
|
fi
|
|
script_dir="$(cd "$(dirname "$script_path")" && pwd -P)"
|
|
|
|
# Load shared utilities
|
|
# shellcheck source=../lib/utils.sh
|
|
source "$script_dir/../lib/utils.sh"
|
|
|
|
if [ ! -d "./schon" ]; then
|
|
log_error "❌ Please run this script from the project's root (where the 'schon' directory lives)."
|
|
exit 1
|
|
fi
|
|
|
|
art_path="$script_dir/../ASCII_ART_SCHON"
|
|
if [ ! -f "$art_path" ]; then
|
|
log_error "❌ Could not find ASCII art at $art_path"
|
|
exit 1
|
|
fi
|
|
|
|
if is_interactive && [ -n "${TERM:-}" ]; then
|
|
clear
|
|
fi
|
|
|
|
if is_interactive; then
|
|
# In interactive mode, show colorful banner
|
|
royal_grey='\033[38;2;127;144;158m'
|
|
reset='\033[0m'
|
|
echo -e "${royal_grey}$(cat "$art_path")${reset}"
|
|
echo
|
|
else
|
|
# In non-interactive mode, show simple banner
|
|
echo "Schon by WISELESS TEAM"
|
|
fi
|