Commit Graph

18 Commits

Author SHA1 Message Date
zimbatm
0f4a3f5059
handle /nix/store edge case
Workaround for this error:

    error: access to absolute path '/nix/store' is forbidden in restricted mode
2022-08-22 22:05:36 +02:00
zimbatm
88ec5a014d
fix store path reference
Handles this error:

  error: the string 'mh6zkfrj8pmwbn8gsyi6wmrilj96d60y-fixture1' is not allowed to refer to a store path

This happens because the substring has the string context propagated to
it, and Nix doesn't like attrset accessor containing those. We know it's
safe to remove the string context because the string won't be added to a
derivation.
2022-08-22 21:55:34 +02:00
zimbatm
318e18ecdc
fmt 2022-08-22 21:55:34 +02:00
ilkecan
825abbb40e
Make directories also match their descendants (#27)
From an end user perspective this makes `inDirectory` redundant.

Closes: #25
2022-08-11 14:18:14 +02:00
Jonas Chevalier
3e81a637cd
matchName: filter out files or folders with this exact name (#24) 2022-05-26 20:47:46 +02:00
ilkecan
38bc843f1c
Remove unused variables (#19) 2022-02-20 16:37:55 +01:00
ilkecan
19047287c7
Use pathExists instead of isPath in assertion (#16)
What an asserted directory should be is:
- an absolute path
- of an existing
- directory.
`isPath` is too strict in this case since it doesn't allow strings.
`pathExists` checks for the first two property while the last one is
asserted with `readDir`.
2022-01-17 11:35:27 +01:00
ilkecan
676da531f1
Don't match parents while excluding a path (#13) 2022-01-17 11:35:14 +01:00
David Arnold
2a06837d4d
fix: oversight in debugMatch (#14)
debugMatch has to pass the matcher transparently to its wrapped
matcher
2022-01-05 19:32:03 +01:00
zimbatm
3c9e33ed62
rename or to or_
"or" is a keyword in Nix.

Fixes #8
2021-05-05 10:22:00 +02:00
Jonas Chevalier
08602032e4
allow to combine matchers (#4) 2021-04-29 23:12:16 +00:00
zimbatm
a1a479f190
automatically match parent folders
If "src/foo" is used, automatically match the "src" folder.

Fixes #3
2021-04-29 21:55:25 +02:00
Robert Whitaker
21e58193e0
Make paths also match subdirectories (#2)
* Make paths also match subdirectories

This makes matchers that are generated for strings and paths treat the
path as a prefix instead of as the entire path, allowing a path to also
match its subdirectories and contained files.

This allows patterns like `"src"` to also match by default:
- `src/folder_x`
- `src/folder_x/folder_y`
- etc.

* Turn _isPathPrefix into new matcher and restore previous default path behavior

* Update inDirectory to compare string prefixes instead of path segments

This avoids the extra work of splitting the paths into segments and
comparing them piece by piece.

* proposed change

Co-authored-by: zimbatm <zimbatm@zimbatm.com>
2021-04-29 21:48:37 +02:00
zimbatm
1a5e6972c2
rename the 'path' argument to 'root'
It's more explicit that way
2021-04-24 13:52:52 +02:00
zimbatm
669338fbbe
allow/deny -> include/exclude
This is a bit more descriptive.
2021-04-24 13:43:08 +02:00
zimbatm
a1d076b121
document 2021-04-23 19:19:37 +02:00
zimbatm
a1e0618f4c
Make it work 2021-04-23 18:53:18 +02:00
zimbatm
e404d1fd74
hi! 2021-04-23 14:17:03 +02:00