Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --here option for pew workon to prevent current directory to be changed #180

Merged
merged 1 commit into from
Mar 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ The `-r` option can be used to specify a text file listing packages to be instal

List or change working virtual environments.

`usage: pew workon [environment_name]`
`usage: pew workon [environment_name] [--here]`

If no `environment_name` is given the list of available environments is printed to stdout.
If no `environment_name` is given the list of available environments is printed to stdout. If `--here` is provided, current directory is not changed even if a project path is associated with `environment_name`.

### mktmpenv ###

Expand Down Expand Up @@ -434,6 +434,7 @@ Everyone who submitted patches/PR, as of September 2015:
- Robin
- Matei Trușcă
- Lucas Cimon
- Alexandre Decan


Thanks also to Michael F. Lamb for his thought provoking gist and to Doug Hellman for virtualenvwrapper
Expand Down
5 changes: 4 additions & 1 deletion pew/pew.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,10 @@ def list_and_exit():

# Check if the virtualenv has an associated project directory and in
# this case, use it as the current working directory.
project_dir = get_project_dir(env) or os.getcwd()
project_dir = get_project_dir(env)
if project_dir is None or argv[-1] == '--here':
project_dir = os.getcwd()

shell(env, cwd=project_dir)


Expand Down