#!/usr/bin/env bash VERSION="3.0.0" update() { local bin=$(which git-extras) local prefix=${bin%/*/*} local orig=$PWD cd /tmp \ && rm -fr ./git-extras \ && echo "Setting up 'git-exras'...." \ && git clone https://github.com/tj/git-extras.git &> /dev/null \ && cd git-extras \ && git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) &> /dev/null \ && PREFIX="$prefix" make install \ && cd "$orig" \ && echo "... updated git-extras $VERSION -> $(git extras --version)" } case "$1" in -v|--version) echo $VERSION && exit 0 ;; update) update ;; *) man git-extras ;; esac