aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com>2023-07-31 19:19:21 +0200
committerGitHub <noreply@github.com>2023-07-31 17:19:21 +0000
commit8b05b15355f47009cc6cf17917fcc5cf88b8b493 (patch)
tree7b22656089b7828921c700f9f57d806f2cd231b8
parentfix(server): Teapot is a cup of coffee (#1137) (diff)
downloadatuin-8b05b15355f47009cc6cf17917fcc5cf88b8b493.zip
fix: nushell empty hooks (#1138)
Co-authored-by: Andrea Jemmett <1787979+acidghost@users.noreply.github.com>
-rw-r--r--atuin/src/shell/atuin.nu8
1 files changed, 6 insertions, 2 deletions
diff --git a/atuin/src/shell/atuin.nu b/atuin/src/shell/atuin.nu
index f86636cc..33ce0068 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)
)
)