Commit 7f946259 by Miikka Koskinen Committed by GitHub

fix: fix `poetry shell` for nushell (#7919)

parent 9d03170f
......@@ -104,13 +104,14 @@ class Shell:
if self._name in ["zsh", "nu"]:
c.setecho(False)
if self._name == "zsh":
# Under ZSH the source command should be invoked in zsh's bash emulator
c.sendline(f"emulate bash -c '. {shlex.quote(str(activate_path))}'")
if self._name == "zsh":
# Under ZSH the source command should be invoked in zsh's bash emulator
c.sendline(f"emulate bash -c '. {shlex.quote(str(activate_path))}'")
else:
cmd = f"{self._get_source_command()} {shlex.quote(str(activate_path))}"
if self._name == "fish":
# Under fish "\r" should be sent explicitly
if self._name in ["fish", "nu"]:
# Under fish and nu "\r" should be sent explicitly
cmd += "\r"
c.sendline(cmd)
......@@ -143,8 +144,10 @@ class Shell:
return "activate" + suffix
def _get_source_command(self) -> str:
if self._name in ("fish", "csh", "tcsh", "nu"):
if self._name in ("fish", "csh", "tcsh"):
return "source"
elif self._name == "nu":
return "overlay use"
return "."
def __repr__(self) -> str:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment