diff --git a/build-utils/templ-edit.nu b/build-utils/templ-edit.nu new file mode 100755 index 0000000..e38fc89 --- /dev/null +++ b/build-utils/templ-edit.nu @@ -0,0 +1,47 @@ +#!/usr/bin/env nu + +def main [] {} + +def "main find" [ + file: string +] { + open $file --raw + | lines + | enumerate + | update item {|it| $it.item | parse '{current}#:{name}:-{template}-:#' } + | filter {|it| $it.item | is-not-empty} + | flatten -a + | rename -c { index: line } +} + +# TODO: support mroe then single template +def "main edit" [ + file: path + name: string + to: string + --preview +] { + let template = main find $file + | where name == $name + | first; + let new = $template.template + | str replace $"%($name)%" $to + | append $" #:($template.name):-($template.template)-:#" + | str join; + let rest = open $file --raw + | lines + | enumerate + | where index != $template.line + | append { index: $template.line, item: $new} + | sort-by index + | reject index + | get item + | append "" + | str join "\n"; + + if $preview { + print $rest + } else { + $rest | save -f $file + } +} diff --git a/modules/desktop-environment/home/typst.nix b/modules/desktop-environment/home/typst.nix index 4bf4d64..e6fc769 100644 --- a/modules/desktop-environment/home/typst.nix +++ b/modules/desktop-environment/home/typst.nix @@ -4,8 +4,8 @@ domain = "forge.katzen.cafe"; owner = "schrottkatze"; repo = "typst-configs"; - rev = "569cd8525a85878140baf5952597f27fd7ea51d3"; - sha256 = "sha256-4pAammwrFGhpSquEsh4QSd8Hw/ioHm3fMiC5oqNgbAQ="; + rev = "569cd8525a85878140baf5952597f27fd7ea51d3"; #:REV:- rev = "%REV%";-:# + sha256 = "sha256-4pAammwrFGhpSquEsh4QSd8Hw/ioHm3fMiC5oqNgbAQ="; #:SHA:- sha256 = "%SHA%";-:# }; flow = pkgs.fetchFromGitHub { owner = "MultisampledNight";