ignore crate: New API for custom ignore file processing? #2352
Unanswered
typesanitizer
asked this question in
General
Replies: 1 comment 1 reply
-
Could you please provide a simple concrete example of how you expect it to work? Show the inputs, show the code, show the desired output. It's really really hard to understand what you're asking for otherwise. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There is this API for adding custom ignore files.
However, it assumes that the file has the same syntax as a
.gitignore
. I'd like to be able to use.gitattributes
like so:.gitattributes is recognized by
git check-attr
, making it more convenient than a custom ignore file. It is also used by GitHub (e.g. for marking generated files), so I'd like to use it instead of creating another filename.mytoolignore
like.rgignore
.Would you be open to adding a new method which allows for a custom way to map the file contents to a list of git-like glob patterns?
The most
hackysimple solution would probably be to have an extra function argument which does a (byte)string -> (byte)string transform on the file contents, with the return value being in.gitignore
format. Doesn't feel terribly elegant, but it avoids the need to expose extra internal types. I saw a comment in the source code that the current APIs are too complicated to expose the core Ignore type directly. https://sourcegraph.com/github.com/BurntSushi/ripgrep/-/blob/crates/ignore/src/dir.rs?L11-14Beta Was this translation helpful? Give feedback.
All reactions