
___x_cmd_moon___runmain(){
    ___x_cmd_hascmd moon || {

        if ___x_cmd_is_stdout2tty && ___x_cmd_runmode_allow_chatty; then
            moon:info "moonbit is not found in the environment."
            ___x_cmd ui yesno 'Do you want to use `x moon --install`' || return $?

            ___x_cmd_moon___install || {
                moon:info "Abort because fail to install moonbit."
                return $?
            }

            ___x_cmd_hascmd moon || {
                moon:warn "moon command is not found. Maybe a restart is required to refresh the PATH to activate moon in the current environment"
                return 1
            }
        else
            N=moon M="Please install moon -> x moon --install" log:ret:1
        fi
    }

    ___x_cmd_moon___runmain(){
        ___x_cmd_cmds moon "$@"
    } && ___x_cmd_moon___runmain "$@"
}
