feat: control filenames in DiffOptions#36
Conversation
src/diff/mod.rs
Outdated
| pub struct DiffOptions { | ||
| compact: bool, | ||
| context_len: usize, | ||
| original_filename: Option<String>, |
There was a problem hiding this comment.
I think it'd be better or more general to use Option<Cow<'a, str>> here. That'd be a semver-breaking change on DiffOptions so I went with just a String instead.
If you're willing to take a semver break, I'd be happy to add a <'a> to DiffOptions and use Cow<'a, str> here instead. That'd also simplify the changes I made in create_patch.
There was a problem hiding this comment.
As a compromise we can use a Cow<'static, str> to avoid adding the lifetime to DiffOptions for now.
There was a problem hiding this comment.
Ah, good call. Thanks!
|
@eholk thanks for the PR! This has been a feature requested in the past so i suppose its time to add it :) |
|
I'll try to make another release with this change by the end of the day. |
|
Thanks for taking the change and for the quick response! |
I'm using diffy to format output in a test running, to make it easier to find where our actual output differed from the expected output. As a small quality of life improvement, it'd be nice if the diffs said "expected" and "actual" rather than "original" and "modified".
This PR adds options to
DiffOptionsto be able to explicitly set the filenames.