___x_cmd_job_run(){
    # if [ "$#" -eq 0 ]; then
    #     return 1
    # fi

    # local type=failfast
    # while [ "$#" -gt 0 ]; do
    #     case "$1" in
    #         --failfast)
    #             type=failfast
    #         ;;
    #         # TODO: Add more strategies in the future
    #     esac
    # done

    ___x_cmd_job_failfast_run "$@"
}

___x_cmd_job_failfast_run(){
    local concurrency
    local description
    case "$1" in
        -c|--concurency)
            if [ -z "$2" ]; then
                job:error "Fail to start job_failfast_run() ==> Please provide value after $1"
                return 1
            fi
            concurrency="${2}";     shift 2
            ;;
        -d|--description)
            if [ -z "$2" ]; then
                job:error "Fail to start job_failfast_run() ==> Please provide value after $1"
                return 1
            fi
            description="${2}";     shift 2
            ;;
    esac

    [ "$1" != -- ] || shift

    [ -n "$1" ] || {
        job:error "Fail to start job_failfast_run() ==> Please provide function name or executable arg list"
        return 1
    }

    log:sub:init jobrun job "Job run in failfast mode"

    (
        x job failfast init "$concurrency" "$description"
        "$@"
    ) | (
        # TODO: Make sure it disable the flatlog
        x job failfast fini
    )
}
