Skip to content

Instantly share code, notes, and snippets.

@kuoe0
Created May 10, 2016 08:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuoe0/1091c0ad3a4e7c993acf1e71fe907b22 to your computer and use it in GitHub Desktop.
Save kuoe0/1091c0ad3a4e7c993acf1e71fe907b22 to your computer and use it in GitHub Desktop.
Autoenv for Gecko
################################################################################
# Usage: ln -s </path/to/this/file> $GECKO/.autoenv.zsh
################################################################################
OS=$(uname)
autostash GECKO=$(git rev-parse --show-toplevel)
alias mach="$GECKO/mach"
# Load completion for mach
autoload bashcompinit
bashcompinit
source "$GECKO/python/mach/bash-completion.sh"
# Load git-cinnabar
if echo "$PATH" | grep -q "cinnabar"; then
echo "git-cinnabar is already ready!"
else
LOCATE="locate"
[[ "$OS" = "Darwin" ]] && LOCATE="mdfind" # use `mdfind` in OS X as locate
if [[ -z ${CINNABAR_PATH+x} ]]; then
# cache CINNABAR_PATH
export CINNABAR_PATH=$($LOCATE git-cinnabar | grep cinnabar | sort | head -n 1)
fi
autostash PATH="$CINNABAR_PATH:$PATH"
echo "git-cinnabar is ready!"
fi
################################################################################
# Usage: ln -s </path/to/this/file> $GECKO/.autoenv_leave.zsh
################################################################################
unalias mach
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment