Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nushell activation scripts #2170

Merged
merged 73 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
e1c7d88
nushell activation scripts
elferherrera Aug 16, 2021
880c067
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 16, 2021
1dd281e
nushell activate template
elferherrera Aug 17, 2021
efd6cf1
Merge branch 'nushell' of https://github.com/elferherrera/virtualenv …
elferherrera Aug 17, 2021
aa53639
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 17, 2021
76990f1
alias in activate
elferherrera Aug 19, 2021
11553e7
Merge branch 'nushell' of https://github.com/elferherrera/virtualenv …
elferherrera Aug 19, 2021
8c02108
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 19, 2021
e614214
correction in text
elferherrera Aug 19, 2021
9794951
Merge branch 'nushell' of https://github.com/elferherrera/virtualenv …
elferherrera Aug 19, 2021
463e77b
dealias of pydoc and deactivate
elferherrera Aug 19, 2021
fa89fc5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 19, 2021
9abbbfe
using dest_folder for variables
elferherrera Aug 20, 2021
4099f95
Merge branch 'nushell' of https://github.com/elferherrera/virtualenv …
elferherrera Aug 20, 2021
ac8eb3b
activation and deactivation scripts for nu
elferherrera Aug 21, 2021
41ae376
removed comments
elferherrera Aug 21, 2021
3e46b20
install nushell for test
elferherrera Aug 24, 2021
11c82b6
added sudo in workflow
elferherrera Aug 26, 2021
287f758
removed unused import
elferherrera Aug 28, 2021
dfe9ae6
print path
elferherrera Aug 28, 2021
ecf147b
removed awk for cut in workflow
elferherrera Aug 28, 2021
bbe1d75
original workflow file
elferherrera Aug 28, 2021
8396948
nushell workflow
elferherrera Aug 28, 2021
7ac9316
empty commit
elferherrera Aug 28, 2021
1b79414
correctec check.yml file
elferherrera Aug 28, 2021
5e519ae
copy nu to bin folder instead of PATH
elferherrera Aug 28, 2021
c78e504
added more explicit runner.os for context
elferherrera Aug 30, 2021
1eae3b0
strip components during untar
elferherrera Aug 30, 2021
564dd19
untar to nushell folder
elferherrera Aug 30, 2021
b1c2e41
adding option for lack of prompt
elferherrera Aug 31, 2021
5f68d53
use ensure_text on DEACTIVATE_PATH
elferherrera Aug 31, 2021
2c252b5
simplify deactivate in test
elferherrera Aug 31, 2021
93a0cbc
windows nu install with scoop
elferherrera Aug 31, 2021
4953b74
removed unused import
elferherrera Aug 31, 2021
f561910
removed unused import
elferherrera Aug 31, 2021
4a934db
expanded commands to install scoop
elferherrera Aug 31, 2021
87a6b26
install nushell with choco
elferherrera Aug 31, 2021
c340d7c
change name of cmd for windows
elferherrera Sep 1, 2021
52fc190
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 1, 2021
9dd4828
linux line ending change
elferherrera Sep 1, 2021
2f0ddb1
Merge branch 'nushell' of https://github.com/elferherrera/virtualenv …
elferherrera Sep 1, 2021
f641678
use os path join for 2.7
elferherrera Sep 1, 2021
8c1463f
trigger with comment
elferherrera Sep 1, 2021
9704d2c
using Path to join
elferherrera Sep 1, 2021
1bcc292
only windows workflow
elferherrera Sep 1, 2021
393c331
all tests
elferherrera Sep 1, 2021
c0be11c
brew nu 0.36
elferherrera Sep 1, 2021
10411da
brew nu 0.36
elferherrera Sep 1, 2021
ace3fbd
from binaries
elferherrera Sep 1, 2021
edb4e61
from binaries
elferherrera Sep 1, 2021
0af1c06
from binaries
elferherrera Sep 1, 2021
7576626
from binaries
elferherrera Sep 1, 2021
2f88684
from binaries
elferherrera Sep 1, 2021
f8955e1
from binaries
elferherrera Sep 1, 2021
374afba
using brew
elferherrera Sep 1, 2021
18a00fe
using brew
elferherrera Sep 1, 2021
3483f64
testing all
elferherrera Sep 1, 2021
53523dc
testing brew
elferherrera Sep 2, 2021
b91a7c9
testing brew
elferherrera Sep 2, 2021
e36488c
testing brew
elferherrera Sep 2, 2021
b309243
Remove the PYTHONEXECUTABLE variable from nushell scripts
lily-mara Sep 16, 2021
743f0cb
Merge pull request #1 from lily-mara/nushell
elferherrera Sep 16, 2021
e173b3b
change command_prompt to command_script
elferherrera Sep 16, 2021
215e839
Merge branch 'nushell' of https://github.com/elferherrera/virtualenv …
elferherrera Sep 16, 2021
4dade58
all tests enabled
elferherrera Sep 16, 2021
dbdff01
removed sys plugin
elferherrera Sep 16, 2021
8f654a4
get path using shutil
elferherrera Sep 16, 2021
7d7a3db
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 16, 2021
80e7165
import lint
elferherrera Sep 16, 2021
ae48be0
Merge branch 'nushell' of https://github.com/elferherrera/virtualenv …
elferherrera Sep 16, 2021
0d7dbed
using find executable
elferherrera Sep 16, 2021
aed2af8
change to prompt_command
elferherrera Sep 16, 2021
96795f9
Ammend command discovery
gaborbernat Sep 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/virtualenv/activation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from .batch import BatchActivator
from .cshell import CShellActivator
from .fish import FishActivator
from .nushell import NushellActivator
from .powershell import PowerShellActivator
from .python import PythonActivator

Expand All @@ -14,4 +15,5 @@
"PythonActivator",
"BatchActivator",
"FishActivator",
"NushellActivator",
]
13 changes: 13 additions & 0 deletions src/virtualenv/activation/nushell/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from __future__ import absolute_import, unicode_literals

from virtualenv.util.path import Path

from ..via_template import ViaTemplateActivator


class NushellActivator(ViaTemplateActivator):
def templates(self):
yield Path("activate.nu")

def as_name(self, template):
return template.stem
32 changes: 32 additions & 0 deletions src/virtualenv/activation/nushell/activate.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Setting all environment variables for the venv
let virtual_env = __VIRTUAL_ENV__

let is_windows = (sys).host.name == "Windows"
let path-sep = (if $is_windows { ";" } { ":" })

let venv-abs-dir = ($virtual_env | path expand)
let venv-name = ($venv-abs-dir | path basename)
let old-path = ($nu.path | str collect ($path-sep))

let new-path = (if ($is_windows) {
let venv-path = ([$virtual_env "__BIN_NAME__"] | path join)
let new-path = ($nu.path | prepend $venv-path | str collect ($path-sep))

[[name, value]; [Path $new-path]]
} {
let venv-path = ([$virtual_env "bin"] | path join)
let new-path = ($nu.path | prepend $venv-path | str collect ($path-sep))

[[name, value]; [PATH $new-path]]
}
)

let new-env = [[name, value]; [VENV_OLD_PATH $old-path] [VIRTUAL_ENV $venv-name]]

load-env ($new-env | append $new-path)

# Creating the new prompt for the session
let virtual_prompt = __VIRTUAL_PROMPT__

let new_prompt = ($"build-string '($virtual_prompt) ' (config get prompt | str find-replace "build-string" "")")
let-env PROMPT_STRING = $new_prompt
7 changes: 7 additions & 0 deletions src/virtualenv/activation/nushell/deactivate.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Setting the old path
let-env $path-name = $nu.env.VENV_OLD_PATH

# Unleting the environment variables that where created when activating the env
gaborbernat marked this conversation as resolved.
Show resolved Hide resolved
unlet-env VIRTUAL_ENV
unlet-env VENV_OLD_PATH
unlet-env PROMPT_STRING