Created
March 4, 2021 11:31
-
-
Save davidszotten/3c02b477c4c173d89c1e4c581fdc2f38 to your computer and use it in GitHub Desktop.
install postactivate link
This file contains hidden or 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
#!/usr/bin/env bash | |
set -euo pipefail | |
if [ -z ${1+x} ] | |
then | |
echo "Usage: $(basename $0) project-name" | |
exit 1 | |
fi | |
PROJECT="$1" | |
TARGET="$WORKON_HOME/$PROJECT/bin/postactivate" | |
if [ ! -f $TARGET ] | |
then | |
echo "Unknown project" | |
exit 1 | |
fi | |
if [ -L $TARGET ] | |
then | |
echo "Already linked" | |
exit 0 | |
fi | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | |
mv $TARGET{,.ORG} | |
ln -s $DIR/$PROJECT.postactivate $TARGET |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment