#!/usr/bin/env bash
## Copy the current branch's name to the clipboard (macOS Only).
## Source: git-extra-commands

#
# Copy the current branch name to the clipboard, or stdout if not on macOS

branch=$(git rev-parse --abbrev-ref HEAD)

if [[ "$(uname -s)" = "Darwin" ]]; then
  echo "$branch" | tr -d '\n' | tr -d ' ' | pbcopy
else
  echo "$branch"
fi
