arkfind
arkfind copied to clipboard
Need a "stop at first find" mode
Currently arkfind
will walk through all directories and archives, constructing the entire tree in memory, and then it will search through that list for whatever the user specified.
It would be nicer if arkfind
printed the results as it went (although it would then be mixed up with the warnings, but that's nothing a stderr
redirect wouldn't fix).
The real utility of this would be a "lazy" mode: sometimes you're only looking for one file, and you know there aren't duplicates. Then arkfind
could quit after it found the first match.
Initially I had tried to implement arkfind
using generators (with the printer and the searcher being coroutines). However, the recursive nature of the code made this quite difficult. See this Stack Overflow question: How can I nest an arbitrary number of Python file context managers?.
What might work, however, is passing the searcher/formatter/printer to the recursing code, so that instead of populating a list in memory, the results are printed as they are found.