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 support for glob pattern #58
Conversation
types_builder.select(t); | ||
if t.contains("*") { | ||
let new_type = format!("type{}", cnt); | ||
types_builder.add(&new_type, t).unwrap(); |
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.
ignore::types::TypesBuilder::add
only returns error when the name
is wrong, not the glob
. We control the name
in this case so it can't go wrong. Thus I used unwrap
here.
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.
Good point - consider putting that as a comment so that the next person to read the code know about this :)
types_builder.negate(t); | ||
if t.contains("*") { | ||
let new_type = format!("type{}", cnt); | ||
types_builder.add(&new_type, t).unwrap(); |
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.
ignore::types::TypesBuilder::add
only returns error when the name
is wrong, not the glob
. We control the name
in this case so it can't go wrong. Thus I used unwrap
here.
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.
Ditto
Also, the code around |
Apart from that, this is a good PR and I agree it's a good way to fix #56 - thank you for your contribution :) |
Looking good, let's merge this. |
Workaround for #56. Instead of regex, I think glob pattern would be more suited because the
ignore
crate already supported it.