fix: nushell empty hooks (#1138)

Co-authored-by: Andrea Jemmett <1787979+acidghost@users.noreply.github.com>
This commit is contained in:
LeoniePhiline 2023-07-31 19:19:21 +02:00 committed by GitHub
parent 73da97666f
commit 8b05b15355
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
)
)