Skip to content

feat: Add rename method to SevenZip wrapper#35

Closed
insign wants to merge 1 commit intomainfrom
feat/add-rename-method-10070328621127277582
Closed

feat: Add rename method to SevenZip wrapper#35
insign wants to merge 1 commit intomainfrom
feat/add-rename-method-10070328621127277582

Conversation

@insign
Copy link
Copy Markdown
Contributor

@insign insign commented Mar 22, 2026

Summary

I have added a new feature to the SevenZip class: the ability to rename files directly inside an archive using the 7z rn command.

This improvement introduces the rename(array $renameList): string method, which accepts an associative array mapping old file paths to new file paths within the archive.

Changes:

  1. Added rename() method in src/SevenZip.php:

    • Supports passing multiple files at once using an associative array ['oldName' => 'newName'].
    • Validates if the archive source path is defined.
    • Validates if the rename list is not empty.
    • Automatically appends the password (-p) flag if set.
  2. Added Unit Tests in tests/SevenZipTest.php:

    • testRename: Validates a successful rename operation on a .7z file, checking the output and asserting the change in fileList().
    • testRenameThrowsExceptionIfEmptyList: Validates that it throws an InvalidArgumentException if the provided rename list is empty.
    • testRenameThrowsExceptionIfNoSource: Validates that it throws an InvalidArgumentException if the source archive is missing.

All 38 assertions pass locally utilizing composer test. No temporary files were committed.


PR created automatically by Jules for task 10070328621127277582 started by @insign

This commit introduces a new `rename` method to the `SevenZip` class.
It wraps the 7-Zip `rn` command, allowing developers to rename files
and directories directly within an existing archive without having
to extract and re-compress the contents.

- Added `rename(array $renameList): string` to `SevenZip.php`.
- Implemented parameter validation (throws `InvalidArgumentException`).
- Provided unit tests covering functionality and exceptions in `SevenZipTest.php`.
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@insign insign closed this Apr 1, 2026
@insign insign deleted the feat/add-rename-method-10070328621127277582 branch April 1, 2026 00:54
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.

1 participant