Created
June 8, 2016 21:27
-
-
Save philkuz/68ddec2a967cc08454dde81d4451d34a to your computer and use it in GitHub Desktop.
Manages a current project as a script
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 that sets the current project | |
function set-project() { | |
if [ $# -ne 1 ]; then | |
echo "command should be formatted as 'set-project <project-dir>'" | |
exit 1 | |
fi | |
if [ "$1" = "." ]; then | |
dir=$(pwd) | |
else | |
dir="$(cd "$(dirname "$1")"; pwd)/$(basename "$1")" | |
fi | |
echo $dir >| $PROJECT_CONFIG | |
} | |
function get-project() { | |
projdir=$(<$PROJECT_CONFIG) | |
echo $projdir | |
} | |
alias project="cd $(get-project)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment