forked from pypa/virtualenv
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_nushell.py
28 lines (20 loc) · 891 Bytes
/
test_nushell.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from shutil import which
from virtualenv.activation import NushellActivator
from virtualenv.info import IS_WIN
def test_nushell(activation_tester_class, activation_tester):
class Nushell(activation_tester_class):
def __init__(self, session):
cmd = which("nu")
if cmd is None and IS_WIN:
cmd = "c:\\program files\\nu\\bin\\nu.exe"
super().__init__(NushellActivator, session, cmd, "activate.nu", "nu")
self.activate_cmd = "overlay use"
self.unix_line_ending = not IS_WIN
def print_prompt(self):
return r"$env.VIRTUAL_PROMPT"
def activate_call(self, script):
# Commands are called without quotes in Nushell
cmd = self.activate_cmd
scr = self.quote(str(script))
return f"{cmd} {scr}".strip()
activation_tester(Nushell)