Ripgrep: Directory ignore command line

Created on 26 Sep 2016  路  7Comments  路  Source: BurntSushi/ripgrep

Do you think it would be valuable to add an option to skip traversing directories? I know I can use an .rgignore file but it's not convenient to copy it from repository to repository.

If so, I think I could try and implement it as well.

enhancement

Most helpful comment

I think rg -g '!*/' PAT will do it.

All 7 comments

I was just looking for an option to not recurse, so yeah, that'd be useful.

I think rg -g '!*/' PAT will do it.

That's not to say we don't want, say, a --depth flag or something that sets a limit on the recursion depth. I think I'd be OK with that. (Certainly, find has it.) Maybe use the same flag name as find? --maxdepth. A depth of 0 could mean "only search current directory."

Ah I missed the -g flag. I suppose I need to read the usage more carefully. I imagine max depth would be easy to add considering you use your walkdir crate too :)

Yes indeedy! Let me know if you'd like to work on it and I won't touch it. :-)

(I think maxdepth should be relatively straight-forward. mindepth would not be. Thankfully, there's less of a use case for that I think.)

I would be happy to try it tonight and I'll keep you updated in this thread. Thanks!

Awesome, thank you. :-)

Was this page helpful?
0 / 5 - 0 ratings