You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
COSMETIC: On Windows, --prompt adds a space to the resulting prompt after its argument; doesn't add space on Linux #1168
When creating a new virtualenv with the --prompt option, on Windows a space is automatically added between the --prompt= value and the tail of the prompt:
maybe I'm being contrary, but I actually think the windows behaviour is incorrect here. After adding a space it makes it impossible to produce a prompt without a space. However you can make a prompt with a space by doing --prompt='(foo) '
@asottile Very good point. At the time I composed this issue, I hadn't really tried to think of use-cases where a required space would be undesirable... but, for example, a forced space prevents crafting a prompt like:
envname-C:\git\project>
For how I construct my prompts, I would like the space to be there by default. But, you're right, it's far more flexible not to mandate the trailing space. I'm now inclined to go the other way with it, and remove the default space on Windows (as long as cmd allows its removal... CONFIRMED, cmd does allow zero space).
Ok, I will revise the PR to REMOVE the mandated space from both Windows cmd and bash templates, and add tests for both to check for the lack of the trailing space.
It looks like a mandated space should similarly be removed from the csh and PowerShell templates. (If new tests are desired for these shells, I'm not sure how to add them so that they integrate with the CI.)
OTOH, fish looks ok to me; and, if I read the xonsh template correctly, it doesn't even mess with the prompt, and so doesn't need to be changed.
Now that I look at it, I think both activate.csh and activate.ps1 actually ignore--prompt. The lines of code I linked to above appear actually just to always use the environment name as the default prefix.
Is this desired behavior? Or should these be revised to obey --prompt?
Activity
gaborbernat commentedon Jan 14, 2019
@bskinn sure, feel free to do so.
Modify activate.sh to add space after --prompt arg
Modify activate.sh to add space after --prompt arg
Modify activate.sh to add space after --prompt arg
Modify activate.sh to add space after --prompt arg
asottile commentedon Jan 15, 2019
maybe I'm being contrary, but I actually think the windows behaviour is incorrect here. After adding a space it makes it impossible to produce a prompt without a space. However you can make a prompt with a space by doing
--prompt='(foo) 'bskinn commentedon Jan 15, 2019
@asottile Very good point. At the time I composed this issue, I hadn't really tried to think of use-cases where a required space would be undesirable... but, for example, a forced space prevents crafting a prompt like:
For how I construct my prompts, I would like the space to be there by default. But, you're right, it's far more flexible not to mandate the trailing space. I'm now inclined to go the other way with it, and remove the default space on Windows (
as long asCONFIRMED,cmdallows its removal...cmddoes allow zero space).@gaborbernat?
gaborbernat commentedon Jan 15, 2019
I can see peoples complaining once we remove, but let's bite the bullet. Let's remove it.
bskinn commentedon Jan 15, 2019
Ok, I will revise the PR to REMOVE the mandated space from both Windows
cmdandbashtemplates, and add tests for both to check for the lack of the trailing space.It looks like a mandated space should similarly be removed from thecshand PowerShell templates. (If new tests are desired for these shells, I'm not sure how to add them so that they integrate with the CI.)OTOH,
fishlooks ok to me; and, if I read thexonshtemplate correctly, it doesn't even mess with the prompt, and so doesn't need to be changed.bskinn commentedon Jan 16, 2019
Just to raise the possibility...what if this change turns out to be a https://xkcd.com/1172/ ? If, say, someone is inspecting %PROMPT% &c to sniff which venv is active.
asottile commentedon Jan 16, 2019
Seems unlikely when $VIRTUAL_ENV is a thing
bskinn commentedon Jan 17, 2019
Now that I look at it, I think both
activate.cshandactivate.ps1actually ignore--prompt. The lines of code I linked to above appear actually just to always use the environment name as the default prefix.Is this desired behavior? Or should these be revised to obey
--prompt?gaborbernat commentedon Jan 17, 2019
I would say should be revised 👍