bahaghari/lib: update importYAML to be more correct

This commit is contained in:
Gabriel Arazas 2024-02-24 18:52:19 +08:00
parent 7159fc597f
commit 8f7e13734a
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -14,14 +14,17 @@
https://pkg.go.dev/gopkg.in/yaml.v3#readme-compatibility https://pkg.go.dev/gopkg.in/yaml.v3#readme-compatibility
Type: importYAML :: Path -> any Type: importYAML :: Path -> any
Example:
importYAML ./simple.yml
*/ */
importYAML = path: importYAML = path:
let let
data = pkgs.runCommand "convert-yaml-to-json" { } '' dataDrv = pkgs.runCommand "convert-yaml-to-json" { } ''
${pkgs.lib.getExe' pkgs.yaml2json "yaml2json"} < ${path} > $out ${pkgs.lib.getExe' pkgs.yaml2json "yaml2json"} < "${path}" > "$out"
''; '';
in in
pkgs.lib.importJSON data; pkgs.lib.importJSON dataDrv.outPath;
/* Convert a given decimal number to a specified base digit with the set of /* Convert a given decimal number to a specified base digit with the set of
glyphs for each digit as returned from lib.toBaseDigits. glyphs for each digit as returned from lib.toBaseDigits.