mirror of
https://forge.katzen.cafe/schrottkatze/nix-configs.git
synced 2025-10-28 08:15:16 +01:00
streaming hell
This commit is contained in:
parent
2ff7374798
commit
c3e08a9df4
4 changed files with 55 additions and 6 deletions
|
|
@ -8,10 +8,11 @@ def "main find" [
|
|||
open $file --raw
|
||||
| lines
|
||||
| enumerate
|
||||
| update item {|it| $it.item | parse '{current}#:{name}:-{template}-:#' }
|
||||
| filter {|it| $it.item | is-not-empty}
|
||||
| update item {|it| $it.item | parse '{current}# :{name}:-{template}-:#' }
|
||||
| where {|it| $it.item | is-not-empty }
|
||||
| flatten -a
|
||||
| rename -c { index: line }
|
||||
| to json
|
||||
}
|
||||
|
||||
# TODO: support mroe then single template
|
||||
|
|
@ -22,11 +23,12 @@ def "main edit" [
|
|||
--preview
|
||||
] {
|
||||
let template = main find $file
|
||||
| from json
|
||||
| where name == $name
|
||||
| first;
|
||||
let new = $template.template
|
||||
| str replace $"%($name)%" $to
|
||||
| append $" #:($template.name):-($template.template)-:#"
|
||||
| append $" # :($template.name):-($template.template)-:#"
|
||||
| str join;
|
||||
let rest = open $file --raw
|
||||
| lines
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue