Commit 55024b34 by Emilien Fugier Committed by GitHub

feat(shell_support): add nushell (#6063)

* feat(shell_support): add nushell

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

Co-authored-by: emilien fugier <emilien.fugier@adevinta.com>
parent 62701fe8
...@@ -46,9 +46,9 @@ optional = false ...@@ -46,9 +46,9 @@ optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
[package.extras] [package.extras]
redis = ["redis (>=3.3.6,<4.0.0)"]
memcached = ["python-memcached (>=1.59,<2.0)"]
msgpack = ["msgpack-python (>=0.5,<0.6)"] msgpack = ["msgpack-python (>=0.5,<0.6)"]
memcached = ["python-memcached (>=1.59,<2.0)"]
redis = ["redis (>=3.3.6,<4.0.0)"]
[[package]] [[package]]
name = "certifi" name = "certifi"
...@@ -233,10 +233,10 @@ six = ">=1.9" ...@@ -233,10 +233,10 @@ six = ">=1.9"
webencodings = "*" webencodings = "*"
[package.extras] [package.extras]
all = ["genshi", "chardet (>=2.2)", "lxml"]
chardet = ["chardet (>=2.2)"]
genshi = ["genshi"]
lxml = ["lxml"] lxml = ["lxml"]
genshi = ["genshi"]
chardet = ["chardet (>=2.2)"]
all = ["lxml", "chardet (>=2.2)", "genshi"]
[[package]] [[package]]
name = "httpretty" name = "httpretty"
...@@ -299,8 +299,8 @@ optional = false ...@@ -299,8 +299,8 @@ optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
[package.extras] [package.extras]
test = ["pytest", "pytest-trio", "pytest-asyncio (>=0.17)", "testpath", "trio", "async-timeout"] trio = ["async-generator", "trio"]
trio = ["trio", "async-generator"] test = ["async-timeout", "trio", "testpath", "pytest-asyncio (>=0.17)", "pytest-trio", "pytest"]
[[package]] [[package]]
name = "keyring" name = "keyring"
...@@ -439,8 +439,8 @@ python-versions = ">=3.6" ...@@ -439,8 +439,8 @@ python-versions = ">=3.6"
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
[package.extras] [package.extras]
dev = ["pre-commit", "tox"] testing = ["pytest-benchmark", "pytest"]
testing = ["pytest", "pytest-benchmark"] dev = ["tox", "pre-commit"]
[[package]] [[package]]
name = "poetry-core" name = "poetry-core"
...@@ -570,7 +570,7 @@ coverage = {version = ">=5.2.1", extras = ["toml"]} ...@@ -570,7 +570,7 @@ coverage = {version = ">=5.2.1", extras = ["toml"]}
pytest = ">=4.6" pytest = ">=4.6"
[package.extras] [package.extras]
testing = ["fields", "hunter", "process-tests", "six", "pytest-xdist", "virtualenv"] testing = ["virtualenv", "pytest-xdist", "six", "process-tests", "hunter", "fields"]
[[package]] [[package]]
name = "pytest-forked" name = "pytest-forked"
...@@ -701,11 +701,11 @@ jeepney = ">=0.6" ...@@ -701,11 +701,11 @@ jeepney = ">=0.6"
[[package]] [[package]]
name = "shellingham" name = "shellingham"
version = "1.4.0" version = "1.5.0"
description = "Tool to Detect Surrounding Shell" description = "Tool to Detect Surrounding Shell"
category = "main" category = "main"
optional = false optional = false
python-versions = "!=3.0,!=3.1,!=3.2,!=3.3,>=2.6" python-versions = ">=3.4"
[[package]] [[package]]
name = "six" name = "six"
...@@ -887,7 +887,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- ...@@ -887,7 +887,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
[metadata] [metadata]
lock-version = "1.1" lock-version = "1.1"
python-versions = "^3.7" python-versions = "^3.7"
content-hash = "15542c18243196724e924f1145d082c3997843f33743544474a56747d144e480" content-hash = "09541fcf8596626fc1d10fc7a2cdb256cfe4bd82cb0f3bf07afd636e62e7322b"
[metadata.files] [metadata.files]
atomicwrites = [ atomicwrites = [
...@@ -1382,8 +1382,8 @@ secretstorage = [ ...@@ -1382,8 +1382,8 @@ secretstorage = [
{file = "SecretStorage-3.3.2.tar.gz", hash = "sha256:0a8eb9645b320881c222e827c26f4cfcf55363e8b374a021981ef886657a912f"}, {file = "SecretStorage-3.3.2.tar.gz", hash = "sha256:0a8eb9645b320881c222e827c26f4cfcf55363e8b374a021981ef886657a912f"},
] ]
shellingham = [ shellingham = [
{file = "shellingham-1.4.0-py2.py3-none-any.whl", hash = "sha256:536b67a0697f2e4af32ab176c00a50ac2899c5a05e0d8e2dadac8e58888283f9"}, {file = "shellingham-1.5.0-py2.py3-none-any.whl", hash = "sha256:a8f02ba61b69baaa13facdba62908ca8690a94b8119b69f5ec5873ea85f7391b"},
{file = "shellingham-1.4.0.tar.gz", hash = "sha256:4855c2458d6904829bd34c299f11fdeed7cfefbf8a2c522e4caea6cd76b3171e"}, {file = "shellingham-1.5.0.tar.gz", hash = "sha256:72fb7f5c63103ca2cb91b23dee0c71fe8ad6fbfd46418ef17dbe40db51592dad"},
] ]
six = [ six = [
{file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
......
...@@ -61,7 +61,7 @@ pkginfo = "^1.5" ...@@ -61,7 +61,7 @@ pkginfo = "^1.5"
platformdirs = "^2.5.2" platformdirs = "^2.5.2"
requests = "^2.18" requests = "^2.18"
requests-toolbelt = "^0.9.1" requests-toolbelt = "^0.9.1"
shellingham = "^1.1" shellingham = "^1.5"
tomlkit = ">=0.11.1,<1.0.0" tomlkit = ">=0.11.1,<1.0.0"
# exclude 20.4.5 - 20.4.6 due to https://github.com/pypa/pip/issues/9953 # 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)" virtualenv = "(>=20.4.3,<20.4.5 || >=20.4.7)"
......
...@@ -93,7 +93,7 @@ class Shell: ...@@ -93,7 +93,7 @@ class Shell:
self._path, ["-i"], dimensions=(terminal.height, terminal.width) self._path, ["-i"], dimensions=(terminal.height, terminal.width)
) )
if self._name == "zsh": if self._name in ["zsh", "nu"]:
c.setecho(False) c.setecho(False)
c.sendline(f"{self._get_source_command()} {shlex.quote(str(activate_path))}") c.sendline(f"{self._get_source_command()} {shlex.quote(str(activate_path))}")
...@@ -119,13 +119,15 @@ class Shell: ...@@ -119,13 +119,15 @@ class Shell:
suffix = ".ps1" suffix = ".ps1"
elif self._name == "cmd": elif self._name == "cmd":
suffix = ".bat" suffix = ".bat"
elif self._name == "nu":
suffix = ".nu"
else: else:
suffix = "" suffix = ""
return "activate" + suffix return "activate" + suffix
def _get_source_command(self) -> str: def _get_source_command(self) -> str:
if self._name in ("fish", "csh", "tcsh"): if self._name in ("fish", "csh", "tcsh", "nu"):
return "source" return "source"
return "." return "."
......
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