Skip to content

Commit 75518b1

Browse files
esafakpre-commit-ci[bot]gaborbernat
authored
Add warning for incorrect usage of Nushell activation script (#2906)
Co-authored-by: Emre Şafak <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bernát Gábor <[email protected]>
1 parent 430eb4b commit 75518b1

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Warn on incorrect invocation of Nushell activation script - by :user:`esafak`.

src/virtualenv/activation/nushell/activate.nu

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@
66
# but then simply `deactivate` won't work because it is just an alias to hide
77
# the "activate" overlay. You'd need to call `overlay hide foo` manually.
88

9+
# Warn users who accidentally 'source' it
10+
module warning {
11+
export-env {
12+
const file = path self
13+
error make -u {
14+
msg: $"`($file | path basename)` is meant to be used with `overlay use`, not `source`"
15+
}
16+
}
17+
}
18+
19+
use warning
20+
921
export-env {
1022
def is-string [x] {
1123
($x | describe) == 'string'

0 commit comments

Comments
 (0)