mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
patch: Implement d, --directory option
When given, patch will chdir into the given directory before processing the patch file.
This commit is contained in:
parent
7bc3fd8c15
commit
4d8a59f34b
1 changed files with 6 additions and 0 deletions
|
@ -29,9 +29,15 @@ static ErrorOr<void> do_patch(StringView path_of_file_to_patch, Diff::Patch cons
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
StringView directory;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(directory, "Change the working directory to <directory> before applying the patch file", "directory", 'd', "directory");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
if (!directory.is_null())
|
||||
TRY(Core::System::chdir(directory));
|
||||
|
||||
auto input = TRY(Core::File::standard_input());
|
||||
|
||||
auto patch_content = TRY(input->read_until_eof());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue