Skip to content

Commit 08bcbf8

Browse files
authored
Change env example (#1612)
1 parent 7a7d6da commit 08bcbf8

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

book/modules/creating_modules.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,9 @@ cd $env.NU_MODULES_DIR
331331
As with any command defined without `--env`, commands and other definitions in the module use their own scope for environment. This allows changes to be made internal to the module without them bleeding into the user's scope. Add the following to the bottom of `my-utils/mod.nu`:
332332

333333
```nu
334-
export def examine-module [] {
335-
let module_dir = if $env.CURRENT_FILE =~ 'mod\.nu$' {
336-
$env.CURRENT_FILE | path dirname
337-
} else {
338-
$env.CURRENT_FILE
339-
}
334+
export def examine-config-dir [] {
340335
# Changes the PWD environment variable
341-
cd $module_dir
336+
cd $nu.default-config-dir
342337
ls
343338
}
344339
```

0 commit comments

Comments
 (0)