Skip to content

Commit

Permalink
feat(shell_support): add nushell (#6063)
Browse files Browse the repository at this point in the history
* feat(shell_support): add nushell

* feat(shell_detection): bump shellingham version + no echo for nushell

Co-authored-by: emilien fugier <emilien.fugier@adevinta.com>
  • Loading branch information
efugier and emilien fugier authored Aug 4, 2022
1 parent 62701fe commit 55024b3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
30 changes: 15 additions & 15 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pkginfo = "^1.5"
platformdirs = "^2.5.2"
requests = "^2.18"
requests-toolbelt = "^0.9.1"
shellingham = "^1.1"
shellingham = "^1.5"
tomlkit = ">=0.11.1,<1.0.0"
# exclude 20.4.5 - 20.4.6 due to https://github.com/pypa/pip/issues/9953
virtualenv = "(>=20.4.3,<20.4.5 || >=20.4.7)"
Expand Down
6 changes: 4 additions & 2 deletions src/poetry/utils/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def activate(self, env: VirtualEnv) -> int | None:
self._path, ["-i"], dimensions=(terminal.height, terminal.width)
)

if self._name == "zsh":
if self._name in ["zsh", "nu"]:
c.setecho(False)

c.sendline(f"{self._get_source_command()} {shlex.quote(str(activate_path))}")
Expand All @@ -119,13 +119,15 @@ def _get_activate_script(self) -> str:
suffix = ".ps1"
elif self._name == "cmd":
suffix = ".bat"
elif self._name == "nu":
suffix = ".nu"
else:
suffix = ""

return "activate" + suffix

def _get_source_command(self) -> str:
if self._name in ("fish", "csh", "tcsh"):
if self._name in ("fish", "csh", "tcsh", "nu"):
return "source"
return "."

Expand Down

0 comments on commit 55024b3

Please sign in to comment.