Last active
September 16, 2018 00:59
-
-
Save Arxcis/7780b55ea94b6f6ca113da0b9db78a90 to your computer and use it in GitHub Desktop.
refactor goto.sh
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
!/bin/bash | |
PROJECT=`cat ${HOME}/.goto/active-project` | |
GOTOPATH="${HOME}/.goto/projects/${PROJECT}.json" | |
GOTO="/usr/local/opt/goto/the_real_goto.py" | |
# Special case no 1 | |
if [ "$1" = "cd" ]; then | |
# hack to cd in this shell to the ouput of goto show <magicword> | |
path=`goto show "$2"` | |
cd "$path" | |
exit | |
fi | |
# Special case no 2 | |
if [ "$#" -eq 1 ]; then | |
path=$(python /usr/local/opt/goto/the_real_goto.py "$GOTOPATH" show "$2") | |
if [ -d "$path" ]; then | |
cd "$path" | |
exit | |
fi | |
fi | |
# General case | |
python /usr/local/opt/goto/the_real_goto.py "$GOTOPATH" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment