Last active
August 29, 2015 14:18
-
-
Save mithrandi/d1e9248300d25015892d to your computer and use it in GitHub Desktop.
Fish function for development with axiomatic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ax | |
if not set -q PROJECT | |
set PROJECT (basename $VIRTUAL_ENV) | |
end | |
set -l SOURCEDIR {$HOME}/code/{$PROJECT} | |
if test -z "$PROJECT" -o ! -d "$SOURCEDIR" | |
echo "Unable to locate project; do you have a virtualenv activated?" | |
return 1 | |
end | |
set -l BRANCH (hg --repository $SOURCEDIR branch) | |
set -l BASE {$HOME}/deployment/{$PROJECT} | |
set -l DEFAULT_STORE {$BASE}/default.axiom | |
if test $status -ne 0 | |
return $status | |
end | |
set -l BRANCH_STORE {$BASE}/{$BRANCH}.axiom | |
if test ! -d "$BRANCH_STORE" | |
if test -e "$BRANCH_STORE" | |
echo "Refusing to overwrite non-directory {$BRANCH_STORE}." | |
return 1 | |
end | |
command cp --recursive $DEFAULT_STORE $BRANCH_STORE | |
if test $status -ne 0 | |
return $status | |
end | |
end | |
command axiomatic -d $BRANCH_STORE $argv | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment