# shellcheck shell=dash

___x_cmd log init claw

xrc:mod:lib     claw   run/_index   manager/_index \
    service cron connect weixin/_index telegram/_index feishu/_index qywx/_index \
    dispatch

___x_cmd_claw___main(){
    [ "$#" -gt 0 ] ||   set -- manager

    local op="$1";      shift
    case "$op" in
        -h|--help)              ___x_cmd help -m claw "$@";    return 0 ;;
        runstart|runner|service)
                                ___x_cmd_claw_"$op" "$@" ;;
        weixin|feishu|telegram|qywx)
                                ___x_cmd_claw_"$op" "$@" ;;
        start|stop|restart|status)
                                ___x_cmd_claw_service "$op" "$@" ;;
        agentrequest)           ___x_cmd_claw_agentrequest "$@" ;;
        connect|disconnect)     ___x_cmd_claw_"$op" "$@" ;;
        cron|log|manager|workspace)
                                ___x_cmd_claw_"$op" "$@" ;;
        *)
                                if [ "$#" -eq 0 ]; then
                                    ___x_cmd_claw___main___dispatch "$op" "$@"
                                else
                                    ___x_cmd_claw_manager "$op" "$@"
                                fi
                                ;;
    esac
}
