#!/usr/bin/env bash
#
# labels - when in a repo, gives an overview of labels, allows selection.
# deps: gh

set -e

# Load common functions
readonly here="$(dirname "$0")"
source "${here}/github.sh"

main() {
  abort_if_not_repo

  hostname=$(get_hostname)

  gh api \
    "/repos/:owner/:repo/labels" \
    --hostname "$hostname" \
    --paginate \
    --cache 1h \
    --jq ".[].name" \
    | fzf --multi

}

main "$@"
