# shellcheck shell=dash

___x_cmd_gl_group_repo(){
    param:subcmd ___x_cmd_gl_group_repo    \
        ls          "list repo"
        # NOTE: repo create --namespace_id <group_id>
        # create      "groups repo create"
    param:subcmd:try
    param:run

    ___x_cmd_gl_group_repo _param_help_doc
    return 1
}

# Section: List
# https://docs.gitlab.com/ee/api/groups.html
___x_cmd_gl_group_repo_ls(){
    param:scope     ___x_cmd_gl
    param:dsl       '
options:
    #1              "The ID or group path"                                   <>:Address
    --page          "Page number of the results to fetch"                    <>:NatureNumber=1
    --per_page      "Results per page"                                       <>:NatureNumber=20
    --visibility    "Limit by visibility"                                    <>=""  = private public internal ""
    --archived      "Limit by archived status"
    --owned         "Limit to groups explicitly owned by the current user"
    --json|-j       "output raw JSON data"
'
    param:run
    [ -n "$1" ] || M='accepts arg (<group_path> or .id=<group_id>), received empty' arg:ret:64
    local _avt_group="$1"
    ___x_cmd_gl____transform_avt_group || return

    if [ -n "$json" ] || [ -n "$ENFORCE_JSON" ]; then
        ___x_cmd_gl_get_multi "/groups/$_avt_group/projects"  visibility archived
    else
        ___x_cmd_gl_get_multi "/groups/$_avt_group/projects"  visibility archived | \
            x jo 2c            .id .name .path .visibility .web_url | \
            x csv header --add  ID  Name  Path  Visibility  URL     | \
            x csv static_tab
    fi
}
# EndSection