
___x_cmd_termux_shortcut(){
    [ "$#" -gt 0 ] || set -- status

    ___x_cmd_is_termux || {
        termux:error "This module is only supported in termuxOS environments."
        return 1
    }

    local op="$1"; shift
    case "$op" in
        enable)                 ___x_cmd_termux_shortcut_enable              "$@" ;;
        disable)                ___x_cmd_termux_shortcut_disable             "$@" ;;
        status)                 ___x_cmd_termux_shortcut_status              "$@" ;;
        --help|-h)              ___x_cmd help -m termux alias              ;;
        *)                      N=termux M="Unknown subcmd -> $op" log:ret:64  ;;
    esac
}

___x_cmd_termux_shortcut_enable(){
    local word="$1"

    [ -n "$word" ] || {
        termux:info "Using m as the default alias."
        word=m
    }

    shortcut:get:data:init
    ___x_cmd shortcut get --format simple --by category termux | while shortcut:get:parse:data; do
        if [ "$curword" = "$word" ];then
            [ "$curstatus" != enable ] || {
                termux:info "Alias $word has already been enabled."
                return 0
            }
        else
            ___X_CMD_SHORTCUT_NOAUTO_COMPILE_ALL=1 ___x_cmd shortcut rename --platform termux "$curword" "$word" || return $?
        fi
    done

    ___x_cmd shortcut enable  --platform termux --by category termux || return $?
    termux:info "Alias enabled successfully."
    termux:info "To apply the configuration, please reopen a new shell environment."
}

___x_cmd_termux_shortcut_disable(){
    shortcut:get:data:init
    ___x_cmd shortcut get --format simple --by category termux | while shortcut:get:parse:data; do
        if [ "$curstatus" = disable ];then
            termux:info "Alias has already been disabled."
            return 0
        fi
    done

    ___x_cmd shortcut disable --platform termux --by category termux || return $?
    termux:info "Alias disabled successfully."
    termux:info "To apply the configuration, please reopen a new shell environment."
}

___x_cmd_termux_shortcut_status(){
    ___x_cmd shortcut get --by category termux || {
        printf "status: disable\n"
    }
}
