Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#25 Adding support for "prompt" command

open
nobody
None
5
2012-12-09
2012-12-09
Y2K
No

Hello

I was reminded of the "prompt" command recently when I was using python's "virtualenv". The prompt command changes the text before the user input. For example since MS-DOS times, the default prompt was "$p$g" which would give the current directory and the ">" symbol. If you typed "prompt $g" then the text (before the user types anything) would just be ">" without the current working directory.

In the case of "virtualenv" when activated it would include a handy "(projectName) " before the current working directory and the ">" symbol. For example "(PyCmd) C:\projects\PyCmd>". However in PyCmd the "prompt" command doesn't have any effect so it can be difficult to see if the user is currently in a python virtual environment. Would it be possible to implement this? I think this should be an alternative to the default PyCmd abbreviated working directory prompt.

Discussion

  • Horea Haitonic
    Horea Haitonic
    2012-12-09

    You can define a custom prompt (in the form of a Python function) in your init.py file. This should allow you to have what you want (and more ;) )

    See the example-init.py (should be shipped with a recent snapshot of PyCmd) for examples and instructions.