Skip to content

Instantly share code, notes, and snippets.

@atomicstack
Last active March 28, 2022 01:31
Show Gist options
  • Save atomicstack/16059a7dfd26dd5469ba12b20adc147f to your computer and use it in GitHub Desktop.
Save atomicstack/16059a7dfd26dd5469ba12b20adc147f to your computer and use it in GitHub Desktop.
runs git pull in tmux.git and shows the most recent commit SHA; then queries homebrew to see which revision is installed locally
#!/bin/zsh
brew_tmux_path="$( brew info tmux | perl -naE '/[*]$/ and say($F[0])' )"
tmux_installed="${${brew_tmux_path//*HEAD-/}%_1}"
tmux_head=$(cd $HOME/git_tree/tmux && git pull &> /dev/null && git ls -1 | awk '{print $1}')
tmux_head_short=${tmux_head:0:7}
if [[ "$tmux_head_short" == "$tmux_installed" ]]; then
update_status="$(tput setaf 33)Already up to date.$(tput sgr0)"
else
update_status="$(tput setaf 10)Update available!$(tput sgr0)"
fi
[[ -n "$VERBOSE" ]] && echo -e "tmux.git HEAD: $tmux_head_short\ninstalled ver: $tmux_installed"
echo "$update_status"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment