# shellcheck shell=dash disable=SC2034


___x_cmd_install_ls(){
    local X_help_cmd='x help -m install ls';    help:arg:parse

    if ___x_cmd_is_stdout2tty && ___x_cmd_runmode_allow_manual; then
        ___x_cmd_install_ls___app
    else
        if ! ___x_cmd_install_ls___raw; then
            install:info "Exit because no software is selected."
            return 0
        fi
    fi
}

___x_cmd_install_ls___raw(){
    # TODO: Need to be removed in the future
    ___x_cmd_install_update___check || return $?
    ___x_cmd_cmds find "$___X_CMD_INSTALL_DATA" -maxdepth 2 -name "*json" | ___x_cmd_cmds_awk -F/ '{gsub("[.]json", "", $NF); printf("%s\n", $NF)}'
}

___x_cmd_install_ls___app(){
    local x_=
    ___X_CMD_PICK_SHBIN_CODE="xrc pkg install" \
    ___x_cmd storeread_  x pick  --width - --col 10 ___x_cmd_install_ls___raw
    [ -n "$x_" ] || {
        install:info "Exit because no software is selected."
        return 0
    }

    ___x_cmd_install_cat "$x_"
}

___x_cmd_install___pickapp(){
    if ___x_cmd_is_stdout2tty && ___x_cmd_runmode_allow_manual; then
        x pick --col 10 "$@"
    else
        "$@"
    fi
}
