utility="$(
  command -v -- guniq ||
    command -v -- uniq
)"
command -p -- test "${utility-}" = '' &&
  return 127
command git rev-parse --is-inside-work-tree >/dev/null 2>&1 ||
  return "${?:-1}"
case "${1-}" in
-s | --summary)
  shift
  if command git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
    command "${utility-}" --all --color=ansi git
  else
    command "${utility-}" --all --color=ansi directory
  fi
  ;;
*)
  if command git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
    command "${utility-}" --all --breakdown --color=ansi git
  else
    command "${utility-}" --all --breakdown --color=ansi directory
  fi
  ;;
esac
unset utility 2>/dev/null || utility=''

# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

utility="$(
  {
    command -p -- test -x "$(command -v -- rga)" &&
      command -v -- rga
  } || {
    command -p -- test -x "$(command -v -- rg)" &&
      command -v -- rg
  }
)"
command -p -- test "${utility-}" = '' &&
  command -p -- grep -E -r -e "${@-}"
command "${utility-}" \
  --glob '!**.git' \
  --glob '!**node_modules' \
  --glob '!**plugins' \
  --glob '!**themes' \
  --glob '!**dummy*' \
  --hidden \
  "${@-}" 2>/dev/null
unset utility 2>/dev/null || utility=''

