# shellcheck shell=dash
# https://docs.github.com/en/rest/repos/repos#list-organization-repositories
___x_cmd_gh_org_repo_ll() {
    param:scope     ___x_cmd_github
    param:dsl       <<A
options:
    #1          "org space address"                                         <>:Address
    --type      "Specifies the types of repositories you want returned"     <>="all"    = all private public forks sources member
    --sort      "The property to sort the results by"                       <>:UserSort="updated"
    --direction "The order to sort by"                                      <>:Direction="desc"

    --per_page  "Results per page"                                          <>:Number=30
    --page      "Page number of the results to fetch."                      <>:Number=1

    --json|-j   "output origin json data"
    --csv       "output csv data"
    --yml       "output yml data"
A
    param:run
    local Address="${1%%/*}"
    if ___x_cmd_gx_output_is_format; then
        ___x_cmd_gh_get_multi  "/orgs/$Address/repos" type sort direction | ___x_cmd_gx_output_format
    elif [ "$type" = "member" ] ; then
        ___x_cmd_gh_get_multi  "/orgs/$Address/repos" type sort direction | \
            x jo 2c            .full_name  .visibility .permissions.push .permissions.maintain .description | \
            x csv header --add  RepoPath    Visibility  Push              Maintain              Description | \
            if [ -n "$csv" ]; then  ___x_cmd_cmds cat
            else                    ___x_cmd_gh_st_tab
            fi
    else
        ___x_cmd_gh_get_multi  "/orgs/$Address/repos" type sort direction | \
            x jo 2c            .full_name  .visibility .description | \
            x csv header --add  RepoPath    Visibility  Description | \
            if [ -n "$csv" ]; then  ___x_cmd_cmds cat
            else                    ___x_cmd_gh_st_tab  -           10          100%
            fi

    fi
}
