commit df4e37a56ffcadd9c9146763daaac17fb38ea8bc
parent 45ee9e3179202350fe35cdc42ac76846fde8ce03
Author: figsoda <figsoda@pm.me>
Date: Fri, 26 May 2023 16:20:10 -0400
parent 45ee9e3179202350fe35cdc42ac76846fde8ce03
Author: figsoda <figsoda@pm.me>
Date: Fri, 26 May 2023 16:20:10 -0400
matchers.toml: init
5 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/docs/src/api/matchers.md b/docs/src/api/matchers.md @@ -69,4 +69,12 @@ Matches the file name using the given regex. Instead of a regular loader, the function will also take the regex matches returned by `builtins.match`, as shown in the type signature (`[ String ]`). +## `matchers.toml` + +Source: [`src/matchers/toml.nix`](https://github.com/nix-community/haumea/blob/main/src/matchers/toml.nix) + +Type: `Matcher` + +Matches all TOML files and loads them using `lib.importTOML`. + [`load`]: load.html
diff --git a/src/matchers/toml.nix b/src/matchers/toml.nix @@ -0,0 +1,3 @@ +{ lib, super }: + +super.extension "toml" (_: lib.importTOML)
diff --git a/tests/matchers/__fixture/foo.bar.toml b/tests/matchers/__fixture/foo.bar.toml @@ -0,0 +1,2 @@ +[this] +is = "foo.bar"
diff --git a/tests/matchers/expected.nix b/tests/matchers/expected.nix @@ -1,5 +1,6 @@ { foo."foo.yaml".me = "foo"; + "foo.bar".this.is = "foo.bar"; bar."bar.yml".me = "bar"; baz = { ".nix" = ./__fixture/baz/.nix;
diff --git a/tests/matchers/expr.nix b/tests/matchers/expr.nix @@ -28,6 +28,7 @@ haumea.load { (matchers.regex ''^(.+)\.(yaml|yml)$'' fakeLoadYaml) (matchers.nix haumea.loaders.default) matchers.json + matchers.toml (matchers.always haumea.loaders.path) ]; }