Skip to content

Commit 7a7d6da

Browse files
authored
Fix example (further) (#1610)
1 parent 6ba5776 commit 7a7d6da

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

book/modules/creating_modules.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,13 @@ As with any command defined without `--env`, commands and other definitions in t
332332

333333
```nu
334334
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+
}
335340
# Changes the PWD environment variable
336-
cd ($env.CURRENT_FILE | path dirname)
341+
cd $module_dir
337342
ls
338343
}
339344
```

0 commit comments

Comments
 (0)