#!/bin/bash
# Copyright 2025 Simon Quigley <tsimonq2@ubuntu.com>
# Same license as the Debian packaging

# Check if the terminal supports color
supports_color() {
    if [ -t 1 ]; then
        ncolors=$(tput colors 2>/dev/null)
        if [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
            return 0
        fi
    fi
    return 1
}

MAINMESSAGE="neofetch is deprecated, running fastfetch instead"
DESC="If you find missing functionality, please report a bug by running \`ubuntu-bug fastfetch\` or by visiting this URL: https://bugs.launchpad.net/ubuntu/+source/fastfetch/+filebug"

# Print WARNING in yellow if supported
if supports_color; then
    YELLOW="\e[33m"
    RESET="\e[0m"
    echo -e "${YELLOW}WARNING:${RESET} ${MAINMESSAGE}\n${DESC}\n"
else
    echo -e "WARNING: ${MAINMESSAGE}\n${DESC}\n"
fi

# Execute fastfetch with all passed arguments
exec /usr/bin/fastfetch "$@"
