<commit_before>#!/usr/bin/env bash
#
# set GITHUB_TOKEN to your GitHub or GHE access token
# set GITHUB_API_ENDPOINT to your GHE API endpoint (defaults to https://api.github.com)

if [ -n "$GITHUB_API_ENDPOINT" ]; then
  url=$GITHUB_API_ENDPOINT
else
  url="https://api.github.com"
fi

token=$GITHUB_TOKEN

OUTPUT_FORMAT="list"

dependency_test()
{
  for dep in curl jq ; do
    command -v $dep &>/dev/null || { echo -e "\n${_error}Error:${_reset} I require the ${_command}$dep${_reset} command but it's not installed.\n"; exit 1; }
  done
}

token_test()
{
  if [ -n "$token" ]; then
    token_cmd="Authorization: token $token"
  else
    echo "You must set a Personal Access Token to the GITHUB_TOKEN environment variable"
    exit 1
  fi
}

usage()
{
  echo -e "Usage: $0 [options] <orgname>...\n"
  echo "Options:"
  echo " -h | --help                      Help"
  echo ""
}

# Progress indicator
working() {
   echo -n "."
}

work_done() {
  echo -n "done!"
  echo -e "\n"
}

output_list()
{
  if [[ "$OUTPUT_FORMAT" == "array" ]]; then
    printf '%s\n' "${all_repos[@]}" | sort --ignore-case | sed -E "s/^(.*)/\"$org\/\1\"/g" | paste -sd ',' - > $org.txt
  else
    printf '%s\n' "${all_repos[@]}" | sort --ignore-case > $org.txt
  fi
}

get_repos()
{
  last_repo_page=$( curl -s --head -H "$token_cmd" "$url/orgs/$org/repos?per_page=100" | sed -nE 's/^Link:.*per_page=100.page=([0-9]+)>; rel="last".*/\1/p' )
<commit_msg>Add array-format description to help text<commit_after>#!/usr/bin/env bash
#
# set GITHUB_TOKEN to your GitHub or GHE access token
# set GITHUB_API_ENDPOINT to your GHE API endpoint (defaults to https://api.github.com)

if [ -n "$GITHUB_API_ENDPOINT" ]; then
  url=$GITHUB_API_ENDPOINT
else
  url="https://api.github.com"
fi

token=$GITHUB_TOKEN

OUTPUT_FORMAT="list"

dependency_test()
{
  for dep in curl jq ; do
    command -v $dep &>/dev/null || { echo -e "\n${_error}Error:${_reset} I require the ${_command}$dep${_reset} command but it's not installed.\n"; exit 1; }
  done
}

token_test()
{
  if [ -n "$token" ]; then
    token_cmd="Authorization: token $token"
  else
    echo "You must set a Personal Access Token to the GITHUB_TOKEN environment variable"
    exit 1
  fi
}

usage()
{
  echo -e "Usage: $0 [options] <orgname>...\n"
  echo "Options:"
  echo " -h | --help              Display this help text"
  echo " -a | --array-format      Output the repository list in"
  echo "                          \"<orgname>/<repo1>\",\"<orgname>/<repo2>\" format"
  echo ""
}

# Progress indicator
working() {
   echo -n "."
}

work_done() {
  echo -n "done!"
  echo -e "\n"
}

output_list()
{
  if [[ "$OUTPUT_FORMAT" == "array" ]]; then
    printf '%s\n' "${all_repos[@]}" | sort --ignore-case | sed -E "s/^(.*)/\"$org\/\1\"/g" | paste -sd ',' - > $org.txt
  else
    printf '%s\n' "${all_repos[@]}" | sort --ignore-case > $org.txt
  fi
}

get_repos()
{
  last_repo_page=$( curl -s --head -H "$token_cmd" "$url/orgs/$org/repos?per_page=100" | sed -nE 's/^Link:.*per_page=100.page=([0-9]+)>; rel="last".*/\1/p' )

{'fraction_non_alphanumeric': 0.1906793567443387, 'fraction_numerical': 0.009189366590088613, 'mean_word_length': 3.021108179419525, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2856968', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1168, 'n_words': 307}