Skip to content
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

Add glob matching #8

Merged
merged 4 commits into from May 25, 2018
Merged

Conversation

Hugal31
Copy link
Contributor

@Hugal31 Hugal31 commented May 8, 2018

Tracking issue: #7

  • Add glob matching with defaults patterns:
    • Cargo.toml
    • Cargo.lock
    • src/**/*.rs
    • tests/**/*.rs
    • build.rs
  • Add --include option to add custom patterns.

- Add --include option.
- Add pattern matching in filter_allows.
- Add patterns in Config.
- Defaults patterns accepts "Cargo.toml", "Cargo.lock", "src/**/*.rs", "tests/**/*.rs" and "build.rs".
- Ignore hidden files (starting with a dot) by default.
Strip project dir prefix from modified files instead of concatenating project dir and glob patterns.
Remove usage of the nightly feature (issue number unknown) which caused this error:

```
154 | fn filter_allows(project_dir: &Path, patterns: &[Pattern], mut path: &Path) -> bool {
    |                               -----                                  -----
    |                               |
    |                               these two types are declared with different lifetimes...
...
162 |         path = p;
    |                ^ ...but data from `project_dir` flows into `path` here%                                                                                                                                       ```
src/config.rs Outdated
}

impl<'a> ConfigBuilder<'a> {
pub fn new() -> Self {
let defaults_pattenrs = vec![
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a little typo in pattenrs

src/lib.rs Outdated
.short("i")
.long("include")
.takes_value(true)
.help("Comma separated list of include pattern"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add in addition to the predefined default patterns

@greyblake
Copy link
Owner

@Hugal31 Thank you for your PR. I am ready to merge this after addressing few very minor notes.

@Hugal31
Copy link
Contributor Author

Hugal31 commented May 12, 2018

Done! Thank you for the review!

@greyblake greyblake merged commit 95fe589 into greyblake:master May 25, 2018
@greyblake
Copy link
Owner

@Hugal31 Thank you! Sorry for the delay.
I will publish a new version to crates.io this weekend.

@greyblake greyblake mentioned this pull request Jun 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants