pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

pipenv open MODULE – custom command

Open metakermit opened this issue 7 years ago • 3 comments

I find the pipenv open command super useful for doing little module source code inspection, even a quick patch & pull request. Would it be appropriate to add an option for a custom command to open the module with? For example:

pipenv open --command=atom MODULE

to execute atom path/to/the/module and open the project in Atom.app. Or for a quick look in Finder to drag & drop some files:

pipenv open --command=open MODULE

I don't always work on a computer where $EDITOR is something meaningful, so this would save me a few steps of fiddling.

A lighter-weight alternative (or an addition – for quickly cd-ing in the terminal too) would be if there was an option to just output the path, e.g.:

$ pipenv open --path responder
/Users/kermit/.virtualenvs/responder-react-aladPS82/src/responder/responder

which would allow me to do:

atom `pipenv open --path responder`

One could easily jump to the folder with a quick:

cd `pipenv open --path responder`

What do you think?

metakermit avatar Oct 22 '18 22:10 metakermit

I believe it respects the customary EDITOR environment variable.

uranusjr avatar Oct 23 '18 03:10 uranusjr

True, it's already possible to override the variable temporarily by doing:

EDITOR=atom pipenv open responder

or

EDITOR=open pipenv open responder

If we go for that approach, I'd at least mention the variable in the help page for the open command. Something like:

$ pipenv open --help

Usage: pipenv open [OPTIONS] MODULE

  View a given module in your editor, as defined by the EDITOR environment variable. You can temporarily override it, for example: EDITOR=atom pipenv open responder

metakermit avatar Oct 23 '18 07:10 metakermit

Pull requests are always welcomed!

uranusjr avatar Oct 23 '18 07:10 uranusjr