mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 13:06:08 +02:00
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:
@ -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)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user