Skip to content

Commit df4e37a

Browse files
committed
matchers.toml: init
1 parent 45ee9e3 commit df4e37a

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

docs/src/api/matchers.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,12 @@ Matches the file name using the given regex.
6969
Instead of a regular loader, the function will also take the regex matches
7070
returned by `builtins.match`, as shown in the type signature (`[ String ]`).
7171

72+
## `matchers.toml`
73+
74+
Source: [`src/matchers/toml.nix`](https://github.com/nix-community/haumea/blob/main/src/matchers/toml.nix)
75+
76+
Type: `Matcher`
77+
78+
Matches all TOML files and loads them using `lib.importTOML`.
79+
7280
[`load`]: load.html

src/matchers/toml.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{ lib, super }:
2+
3+
super.extension "toml" (_: lib.importTOML)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[this]
2+
is = "foo.bar"

tests/matchers/expected.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
foo."foo.yaml".me = "foo";
3+
"foo.bar".this.is = "foo.bar";
34
bar."bar.yml".me = "bar";
45
baz = {
56
".nix" = ./__fixture/baz/.nix;

tests/matchers/expr.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ haumea.load {
2828
(matchers.regex ''^(.+)\.(yaml|yml)$'' fakeLoadYaml)
2929
(matchers.nix haumea.loaders.default)
3030
matchers.json
31+
matchers.toml
3132
(matchers.always haumea.loaders.path)
3233
];
3334
}

0 commit comments

Comments
 (0)