github.com/echohead/hub@v2.2.1+incompatible/script/version (about)

     1  #!/usr/bin/env bash
     2  # Displays hub's release version
     3  set -e
     4  
     5  version="$(git describe --tags HEAD 2>/dev/null || true)"
     6  
     7  if [ -z "$version" ]; then
     8    version="$(grep Version commands/version.go | head -1 | cut -d '"' -f2)"
     9    sha="$(git rev-parse --short HEAD 2>/dev/null || true)"
    10    [ -z "$sha" ] || version="${version}-g${sha}"
    11  fi
    12  
    13  echo "${version#v}"