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

Change "local environment" example (yet again!) #1612

Merged
merged 1 commit into from
Nov 2, 2024
Merged
Changes from all commits
Commits
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
9 changes: 2 additions & 7 deletions book/modules/creating_modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,9 @@ cd $env.NU_MODULES_DIR
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`:

```nu
export def examine-module [] {
let module_dir = if $env.CURRENT_FILE =~ 'mod\.nu$' {
$env.CURRENT_FILE | path dirname
} else {
$env.CURRENT_FILE
}
export def examine-config-dir [] {
# Changes the PWD environment variable
cd $module_dir
cd $nu.default-config-dir
ls
}
```
Expand Down