-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for recursively scanning directories #49
Conversation
This means you can now eg navigate to `~/Programming` and run `dura watch` to watch the whole directory recursively. The program will scan each child dir until either a repo is found or the max depth is hit. Includes, excludes and the max depth can be manually tweaked in the `config.json` file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change the include/exclude algorithm? Other than that, if you're feeling ambitious, try to create a test for this in end_to_end_test.rs
. I'm curious how easy it is for others to write tests in that file.
let latency = (Instant::now() - start_time).as_secs_f32(); | ||
let repo = current_path | ||
.to_str() | ||
.unwrap_or("<invalid path>") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I don't terribly like using a null sentinel value here, seems like evades the type system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think cargo format
has authored that to me due to a line-break but it was already there. Happy to make changes while I'm here though. Not sure how to best handle this specific scenario as it's quite an edge case - any preferences?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waiting for the include/exclude algorithm fix
Going to make the changes to the algorithm in a sec. Once that's done I'll push a commit that should resolve everything outstanding.
More than happy to write a test, but I'm struggling a little bit as to exactly what I should be testing. |
@JakeStanger something along the lines of
|
Algorithm now works as follows: 1. Include everything in dir 2. Exclude anything in the exclude list. 3. Include everything from \1 that's also in include list, even if it were excluded in 2 The code has been tidied up in several places to improve error handling and quality.
**THIS TEST IS NOT WORKING YET**
I've just pushed an unfinished/broken test that's a good starting point, as I've gotta drop off and might not be able to get it finished for a few days. If somebody's able to pick it up and get it working that'd be awesome, otherwise if you want me to drop the commit for now and merge it without let me know & I can try and do that tomorrow. |
i took a crack at the test but ran out of time. it's harder than i anticipated. i'll see if i can make it easier to test next week. let's just rollback the test and merge it |
This reverts commit 59b0649.
Cool, I've got ~30 mins so let me know if you want anything else done now |
This works towards implementing features discussed in #3. It is still using the
config.json
format at the moment. I'll pick up discussion in #28 for migrating to a human-friendly format.You can now eg navigate to
~/Programming
and rundura watch
to watch the whole directory recursively. The program will scan each child dir until either a repo is found or the max depth is hit.Includes, excludes and the max depth can be manually tweaked in the
config.json
file.If
include
is non-empty, thenexclude
is ignored.Example config which includes two repos, one at
Programming/dura
and the other atProgramming/unity/my-game
:Example config which excludes all repos inside
Programming/third-party
: