From 9a9d5d847f3259156fea5b24193f4bd505586412 Mon Sep 17 00:00:00 2001 From: NotTheDr01ds <32344964+NotTheDr01ds@users.noreply.github.com> Date: Fri, 1 Nov 2024 22:32:35 -0400 Subject: [PATCH] Fix example (further) --- book/modules/creating_modules.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/book/modules/creating_modules.md b/book/modules/creating_modules.md index d6c71c526db..dbfde9dd878 100644 --- a/book/modules/creating_modules.md +++ b/book/modules/creating_modules.md @@ -332,8 +332,13 @@ As with any command defined without `--env`, commands and other definitions in t ```nu export def examine-module [] { + let module_dir = if $env.CURRENT_FILE =~ 'mod\.nu$' { + $env.CURRENT_FILE | path dirname + } else { + $env.CURRENT_FILE + } # Changes the PWD environment variable - cd ($env.CURRENT_FILE | path dirname) + cd $module_dir ls } ```