mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
Rename range
to slice
(#1014)
Followup for https://github.com/nushell/nushell/pull/14825
This commit is contained in:
parent
1f6ee6c86d
commit
fd686c0b0c
12 changed files with 29 additions and 29 deletions
|
@ -75,7 +75,7 @@ export def "nu-complete kube jsonpath" [context: string] {
|
|||
}
|
||||
} else if ($path | str starts-with '.') {
|
||||
let row = $path | split row '.'
|
||||
let p = $row | range ..-2 | str join '.'
|
||||
let p = $row | slice ..-2 | str join '.'
|
||||
if ($p | is-empty) {
|
||||
$r = ( kubectl get ...$ns -o json $kind $res
|
||||
| from json
|
||||
|
|
|
@ -117,7 +117,7 @@ export def kh [
|
|||
--app (-a): string='test'
|
||||
] {
|
||||
let values = if ($values | is-empty) { [] } else { [--set-json (record-to-set-json $values)] }
|
||||
let target = $valuefile | split row '.' | range ..-2 | append [out yaml] | str join '.'
|
||||
let target = $valuefile | split row '.' | slice ..-2 | append [out yaml] | str join '.'
|
||||
if (not ($target | path exists)) and (([yes no] | input list $'create ($target)?') in [no]) { return }
|
||||
helm template --debug $app $chart -f $valuefile ...$values ...($namespace | with-flag -n)
|
||||
| save -f $target
|
||||
|
|
|
@ -8,7 +8,7 @@ def safe_get [path obj] {
|
|||
|
||||
if ($p | describe -d).type == closure {
|
||||
$r = ($r | do $p $r)
|
||||
$ps = ($ps | range 1..)
|
||||
$ps = ($ps | slice 1..)
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ def safe_get [path obj] {
|
|||
$r = null
|
||||
}
|
||||
}
|
||||
$ps = ($ps | range 1..)
|
||||
$ps = ($ps | slice 1..)
|
||||
}
|
||||
$r
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ export def get_cellpath [record path] {
|
|||
export def set_cellpath [record path value] {
|
||||
if ($path | length) > 1 {
|
||||
$record | upsert ($path | first) {|it|
|
||||
set_cellpath ($it | get ($path | first)) ($path | range 1..) $value
|
||||
set_cellpath ($it | get ($path | first)) ($path | slice 1..) $value
|
||||
}
|
||||
} else {
|
||||
$record | upsert ($path | last) $value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue