diff options
author | Jharrod LaFon <jlafon@eyesopen.com> | 2013-08-13 15:14:01 -0600 |
---|---|---|
committer | Jharrod LaFon <jlafon@eyesopen.com> | 2013-08-13 15:14:01 -0600 |
commit | dbfcd787906e0de581ff2893825438cb49dbb82c (patch) | |
tree | 0f5e12f86f132190f792811f193c5a31c74cd18f /hacking/env-setup.fish | |
parent | 09586735741edf3886d7c318e765acb3ec246e8a (diff) | |
download | ansible-dbfcd787906e0de581ff2893825438cb49dbb82c.tar.gz |
Added an env-setup file for Fish
Diffstat (limited to 'hacking/env-setup.fish')
-rw-r--r-- | hacking/env-setup.fish | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/hacking/env-setup.fish b/hacking/env-setup.fish new file mode 100644 index 0000000000..811b76b7ce --- /dev/null +++ b/hacking/env-setup.fish @@ -0,0 +1,54 @@ +#!/usr/bin/env fish +# usage: source ./hacking/env-setup [-q] +# modifies environment for running Ansible from checkout +set HACKING_DIR (dirname (status -f)) +set FULL_PATH (python -c "import os; print(os.path.realpath('$HACKING_DIR'))") +set ANSIBLE_HOME (dirname $FULL_PATH) +set PREFIX_PYTHONPATH $ANSIBLE_HOME/lib +set PREFIX_PATH $ANSIBLE_HOME/bin +set PREFIX_MANPATH $ANSIBLE_HOME/docs/man + +# Set PYTHONPATH +if not set -q PYTHONPATH + set -gx PYTHONPATH $PREFIX_PYTHONPATH +else + switch PYTHONPATH + case "$PREFIX_PYTHONPATH*" + echo "Appending PYTHONPATH" + set -gx PYTHONPATH $PREFIX_PYTHONPATH:$PYTHONPATH + end +end + +# Set PATH +if not contains $PREFIX_PATH $PATH + set -gx PATH $PREFIX_PATH $PATH +end + +# Set MANPATH +if not contains $PREFIX_MANPATH $MANPATH + if not set -q MANPATH + set -gx MANPATH $PREFIX_MANPATH + else + set -gx MANPATH $PREFIX_MANPATH $MANPATH + end +end +set -gx ANSIBLE_LIBRARY $ANSIBLE_HOME/library +if set -q argv + switch $argv + case '-q' '--quiet' + case '*' + echo "" + echo "Setting up Ansible to run out of checkout..." + echo "" + echo "PATH=$PATH" + echo "PYTHONPATH=$PYTHONPATH" + echo "ANSIBLE_LIBRARY=$ANSIBLE_LIBRARY" + echo "MANPATH=$MANPATH" + echo "" + + echo "Remember, you may wish to specify your host file with -i" + echo "" + echo "Done!" + echo "" + end +end |