Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hagsteel/7a0502c4dd830044f202 to your computer and use it in GitHub Desktop.
Save hagsteel/7a0502c4dd830044f202 to your computer and use it in GitHub Desktop.
#!/bin/bash
[ -z "$VIRTUAL_ENV" ] && { echo "No virtual environment active"; exit 1; }
#let vepath="$VIRTUAL_ENV"
project_file="/.project"
fpath=$VIRTUAL_ENV$project_file
if [ -f "$fpath" ]
then
echo "This virtualenv already have a .project file"
exit 1
fi
echo "Writing virtualenv project path"
touch $VIRTUAL_ENV/.project
echo `pwd` > $VIRTUAL_ENV/.project
@hagsteel
Copy link
Author

Usage:

  1. activate venv
  2. run the script

Note: you can obviously use setvirtualenvproject however this will automatically set the cwd to your project dir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment