From 8b05b15355f47009cc6cf17917fcc5cf88b8b493 Mon Sep 17 00:00:00 2001 From: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com> Date: Mon, 31 Jul 2023 19:19:21 +0200 Subject: [PATCH] fix: nushell empty hooks (#1138) Co-authored-by: Andrea Jemmett <1787979+acidghost@users.noreply.github.com> --- atuin/src/shell/atuin.nu | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/atuin/src/shell/atuin.nu b/atuin/src/shell/atuin.nu index f86636c..33ce006 100644 --- a/atuin/src/shell/atuin.nu +++ b/atuin/src/shell/atuin.nu @@ -35,10 +35,14 @@ def _atuin_search_cmd [...flags: string] { ] | str join "\n" } +$env.config = ($env | default {} config).config +$env.config = ($env.config | default {} hooks) $env.config = ( $env.config | upsert hooks ( $env.config.hooks - | upsert pre_execution ($env.config.hooks.pre_execution | append $_atuin_pre_execution) - | upsert pre_prompt ($env.config.hooks.pre_prompt | append $_atuin_pre_prompt) + | upsert pre_execution ( + $env.config.hooks | get -i pre_execution | default [] | append $_atuin_pre_execution) + | upsert pre_prompt ( + $env.config.hooks | get -i pre_prompt | default [] | append $_atuin_pre_prompt) ) )