From b71d260a8aa7b765df2e9a79cc22d78d25a6ce33 Mon Sep 17 00:00:00 2001 From: Benjamin Flesch Date: Tue, 30 Sep 2025 11:41:53 +0200 Subject: [PATCH 1/2] docs: fix syntax Add missing `)` to docs. --- book/hooks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/hooks.md b/book/hooks.md index 4a78f821cc0..e6999dfb5a4 100644 --- a/book/hooks.md +++ b/book/hooks.md @@ -192,7 +192,7 @@ $env.config = ($env.config | upsert hooks { code: 'print $"changing directory from ($before) to ($after)"' } } -} +}) ``` ## Examples From 61d0b68a0bd280800eae1c50fe2d532a6e0dab7c Mon Sep 17 00:00:00 2001 From: Benjamin Flesch Date: Tue, 30 Sep 2025 11:44:53 +0200 Subject: [PATCH 2/2] Update hooks.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixing example by adding `[` and `]` to provide list to hook ``` Error: nu::shell::invalid_config × Encountered 1 error(s) when updating config Error: nu::shell::type_mismatch × Type mismatch at $env.config.hooks.env_change.PWD ╭─[] 4 │ env_change: { 5 │ ╭─▶ PWD: { 6 │ │ code: 'print $"changing directory from ($before) to ($after)"' 7 │ ├─▶ } · ╰──── expected list, but got record 8 │ } ╰──── ``` --- book/hooks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/hooks.md b/book/hooks.md index e6999dfb5a4..eeccdd413e7 100644 --- a/book/hooks.md +++ b/book/hooks.md @@ -188,9 +188,9 @@ When defining a hook as a string, the `$before` and `$after` variables are set t ```nu $env.config = ($env.config | upsert hooks { env_change: { - PWD: { + PWD: [{ code: 'print $"changing directory from ($before) to ($after)"' - } + }] } }) ```