Fix kv set with a closure argument (#15588)

<!--
if this PR closes one or more issues, you can automatically link the PR
with
them by using one of the [*linking
keywords*](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword),
e.g.
- this PR should close #xxxx
- fixes #xxxx

you can also mention related issues, PRs or discussions!
-->
Fixes #15528 
# Description
Fixed `kv set` passing the pipeline input to the closure instead of the
value stored in that key.

# User-Facing Changes
Now `kv set` will pass the value in that key to the closure.

# Tests + Formatting


# After Submitting
This commit is contained in:
Tyarel
2025-04-22 16:30:38 +02:00
committed by GitHub
parent a9657e17ad
commit 6193679dfc
2 changed files with 43 additions and 9 deletions

View File

@ -38,7 +38,7 @@ export def "kv set" [
# If passed a closure, execute it
let arg_type = ($value_or_closure | describe)
let value = match $arg_type {
closure => { $input | do $value_or_closure }
closure => { kv get $key --universal=$universal | do $value_or_closure }
_ => ($value_or_closure | default $input)
}