Skip to content
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

[Feature Request] Ask for archive password for extraction #1008

Closed
1 task
Heisenborgar opened this issue May 6, 2024 · 3 comments
Closed
1 task

[Feature Request] Ask for archive password for extraction #1008

Heisenborgar opened this issue May 6, 2024 · 3 comments
Labels
feature New feature request

Comments

@Heisenborgar
Copy link

Please describe the problem you're trying to solve

Opening an archive file i.e., zip, or rar on Yazi will automatically extract the contents of the archive file. However, if it is password protected, it fails. To circumvent this, I have to use KDE's Ark to open, input the password, and extract the contents.

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

Make it so that if the archive file is password protected, it will ask for password input on Yazi itself to extract the archive contents.

Additional context

No response

@Heisenborgar Heisenborgar added the feature New feature request label May 6, 2024
@sxyazi
Copy link
Owner

sxyazi commented May 6, 2024

Hi, you can use read -s pass to read the password entered by the user into $pass, and then pass $pass to the unar command, similar to what #51 (comment) did.

I plan to implement compression/decompression as a separate plugin, but haven't found the time, so please use this workaround for now.

@sxyazi sxyazi closed this as completed May 6, 2024
@Heisenborgar
Copy link
Author

Thanks @sxyazi <3

To anyone who stumbles upon this who wants to extract a password protected archive file in Yazi without using any other apps to do it simply go to .config/yazi/keymap.toml, and add this line of code:

{ on = [ "c", "z" ], exec = """ shell 'printf "Password:"; read -s password; unar -p "$password" "$@"' --block --confirm""" },

To test it, select a password protected archive file (space as default) to highlight, then press c, and z. It should ask you for your password, and if the password is correct, it should extract it.

Copy link

github-actions bot commented Jun 6, 2024

I'm going to lock this issue because it has been closed for 30 days. ⏳
This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

2 participants