# SPDX-FileCopyrightText: 2023 CELESTIFYX Team
# SPDX-License-Identifier: GPL-3.0-or-later

_lynxfetch() {
    local cur prev opts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="-c --config -g --generate-config-file -f --generate-config-force \
          -d --distro-override --logo --logo-position -p --preset \
          --print-font-logo --small-logo --only-logo -i --image \
          --image-protocol --color-resolution --suppress-errors \
          --module-override --inline-values --benchmark --benchmark-warn \
          -v --version -h --help"

    case "${prev}" in
        -c|--config|-p|--preset|--module-override|--benchmark-warn)
            return 0
        ;;

        -d|--distro-override)
            COMPREPLY=($(compgen -W "almalinux arch archcraft arcolinux artix asahi asiraos athenaos cachyos centos codex crystal debian devuan elementary endeavouros fedora garuda gentoo kali kaos kiss kubuntu linux linuxlite linuxmint lubuntu manjaro midos miraclelinux mx neon nixos nuros opensuse opensuse_leap opensuse_tumbleweed pardus parrot pikaos pop prismlinux redos rengeos rhel rhinolinux rocky serpent_os slackware snigdhaos solus syntor ubuntu ultramarine vanilla venom void xinux xubuntu zorin" -- "${cur}"))
            return 0
        ;;

        --logo|-i|--image)
            COMPREPLY=($(compgen -f -- "${cur}"))
            return 0
        ;;

        --logo-position)
            COMPREPLY=($(compgen -W "top right left bottom" -- "${cur}"))
            return 0
        ;;

        --image-protocol)
            COMPREPLY=($(compgen -W "kitty sixel iterm" -- "${cur}"))
            return 0
        ;;

        --color-resolution)
            COMPREPLY=($(compgen -W "16 32 64 128 256" -- "${cur}"))
            return 0
        ;;

        --suppress-errors)
            COMPREPLY=($(compgen -W "true false" -- "${cur}"))
            return 0
        ;;
    esac

    if [[ "${cur}" == -* ]]; then
        COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
        return 0
    fi
}

complete -F _lynxfetch lynxfetch
