Refactor xonsh config
This commit is contained in:
17
xonsh/python.xsh
Normal file
17
xonsh/python.xsh
Normal file
@@ -0,0 +1,17 @@
|
||||
def _vv():
|
||||
"""Finds the nearest venv going upward in the directory hierarchy and activates it."""
|
||||
d = Path.cwd()
|
||||
|
||||
while True:
|
||||
if (d / "venv").exists():
|
||||
vox activate @(str(d / "venv"))
|
||||
return True
|
||||
|
||||
if d == d.parent or (d / ".git").exists():
|
||||
print("Could not find venv.")
|
||||
return False
|
||||
|
||||
d = d.parent
|
||||
|
||||
|
||||
aliases["vv"] = _vv
|
||||
Reference in New Issue
Block a user