# shellcheck shell=bash disable=SC2034,SC2154 disable=SC2154
# Section:list & info
# https://gitea.com/api/swagger#/repository/repoListBranches
___x_cmd_fjo_repo_branch_ls(){
    if ___x_cmd_gx_has_format_args "$@"; then
        ___x_cmd_fjo_repo_branch_ll "$@"
        return
    fi

    param:scope     ___x_cmd_fjo
    param:dsl       '
options:
    --repo|-r       "<owner_path>/<repo_path>"                                          <>:RepoName
    --limit         "Results per page"                                                  <>:Numbers="30"
    --page          "Page number of the results to fetch."                              <>:Numbers="1"
    --json|-j       "output json data"
'
    param:run

    ___x_cmd_fjo_param_init_owner_repo

    # ___X_CMD_UI_STATIC=1 ___tea_ui_mutual '___ui_table_json BranchName=.name Protected=.protected LastCommit=.commit.id -- $@' \
    #  ___x_cmd_fjo_get_multi "/repos/${owner_repo}/branches" limit page
    ___x_cmd_fjo_get_multi "/repos/${owner_repo}/branches" |\
        ___x_cmd jo 2c .name .protected .commit.id |\
        ___x_cmd csv header --add  Name    Protected   LastCommit  | \
        ___x_cmd csv static_tab
}
