# shellcheck shell=dash

xrc:mod:lib     neo     fetch/_index   cfg

___x_cmd_neo___main(){
    [ "$#" -gt 0 ]      ||      set -- fetch

    local op="$1";              shift
    case "$op" in
        -h|--help)              ___x_cmd help -m neo        "$@" ;      return 0 ;;
        --cfg)                  ___x_cmd_neo_cfg            "$@" ;;

        update|boot)            ___x_cmd_neo_"$op"          "$@" ;;
        logo)                   ___x_cmd ascii logo         "$@" ;;

        fast|ffch|fastfetch)    ___x_cmd fastfetch          "$@" ;;

        fetch)                  ___x_cmd_neo_fetch          "$@" ;;
        *)                      ___x_cmd_neo_fetch "$op"    "$@" ;;
    esac
}

___x_cmd_neo_boot(){
    local cur_startup=; local cur_tmux=; local cur_sshroot=
    ___x_cmd_neo_cur cur_startup:=startup cur_tmux:=tmux cur_sshroot:=sshroot 2>/dev/null

    neo:debug --startup "$cur_startup" --tmux "$cur_tmux" --sshroot "$cur_sshroot" "start booting"

    if [ "${cur_startup:-no}" = no ]; then
        ___x_cmd rmrf "$___X_CMD_ROOT_DATA/neo/boot"
    elif [ -n "$TMUX" ]; then
        ___x_cmd_neo_fetch "--${cur_tmux:-no}"
    elif [ -n "$SSH_CLIENT" ]; then
        ___x_cmd_neo_fetch "--${cur_sshroot:-no}"
    else
        ___x_cmd_neo_fetch "--${cur_startup:-no}"
    fi
}

___x_cmd_neo_update(){
    ___x_cmd_neo_fetch___update
}
