Skip to content

Commit

Permalink
Default prompt of environment name in batch shell
Browse files Browse the repository at this point in the history
  • Loading branch information
spetafree committed Feb 27, 2020
1 parent 91c80d6 commit 2b24f15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/changelog/1679.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix windows batch (cmd.exe) shell prompt to display environment name by default, simliar to bash behaviour.
6 changes: 6 additions & 0 deletions src/virtualenv/activation/batch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ def instantiate_template(self, replacements, template, creator):
# ensure the text has all newlines as \r\n - required by batch
base = super(BatchActivator, self).instantiate_template(replacements, template, creator)
return base.replace(os.linesep, "\n").replace("\n", os.linesep)

def replacements(self, creator, dest_folder):
base_replacements = super(BatchActivator, self).replacements(creator, dest_folder)
if not base_replacements["__VIRTUAL_PROMPT__"]:
base_replacements["__VIRTUAL_PROMPT__"] = "(%s) " % creator.env_name
return base_replacements

0 comments on commit 2b24f15

Please sign in to comment.