1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 18:55:08 +00:00

LibDiff: Add Diff::write_context_header

This is used to write a context patch header.
This commit is contained in:
Shannon Booth 2023-07-03 18:07:45 +12:00 committed by Andreas Kling
parent f02cf2704c
commit 44f141dd24
2 changed files with 9 additions and 0 deletions

View file

@ -210,4 +210,12 @@ ErrorOr<void> write_context(Hunk const& hunk, Stream& stream, ColorOutput color_
return write_hunk_as_context(split_lines.old_lines, split_lines.new_lines, hunk.location, stream, color_output);
}
ErrorOr<void> write_context_header(StringView old_path, StringView new_path, Stream& stream)
{
TRY(stream.write_formatted("*** {}\n", old_path));
TRY(stream.write_formatted("--- {}\n", new_path));
return stream.write_formatted("***************\n");
}
}