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

fix tldr -u, use unzip -o to "overwrite existing files without prompting" #47

Merged
merged 1 commit into from
Jan 6, 2022
Merged

Conversation

flyxyz123
Copy link
Contributor

@flyxyz123 flyxyz123 commented Jan 5, 2022

after tldr -u, unzip without -o will prompt:

Archive:  /home/xyz/.cache//tldr/tldr.zip
replace /home/xyz/.cache//tldr/page-source/pages/android/settings.md? [y]es, [n]o, [A]ll, [N]one, [r]ename:
...

it requires user input to overwrite existing files
the prompt is hidden by silent, thus the script will show nothing and stop here

use -o to "overwrite existing files without prompting"

@flyxyz123
Copy link
Contributor Author

flyxyz123 commented Jan 5, 2022

for testing I use the following script to reproduce the bug, be careful this testing script will delete ~/test/tzip directory

#!/bin/sh

rm -rf ~/test/tzip/
mkdir -p ~/test/tzip/page-source/
curl -sfL https://github.com/tldr-pages/tldr-pages.github.io/raw/e7dd56b22b1a3ce7f3204565218357adc187c42a/assets/tldr.zip > ~/test/tzip/tldr_old.zip
curl -sfL https://raw.githubusercontent.com/tldr-pages/tldr-pages.github.io/master/assets/tldr.zip > ~/test/tzip/tldr.zip
unzip -d ~/test/tzip/page-source/ -u ~/test/tzip/tldr_old.zip 
echo 'without -o'
sleep 1
unzip -d ~/test/tzip/page-source/ -u ~/test/tzip/tldr.zip

@flyxyz123 flyxyz123 changed the title use unzip -o to "overwrite existing files without prompting" fix tldr -u, use unzip -o to "overwrite existing files without prompting" Jan 5, 2022
@raylee raylee merged commit 7efd4cd into raylee:main Jan 6, 2022
@raylee
Copy link
Owner

raylee commented Jan 6, 2022

Ah, of course. The way I use the script I hadn't hit this, and neglected to write a test around it. I'll add putting a test case for this on my todo list.

For now, this is great, thanks!

@flyxyz123 flyxyz123 deleted the fly branch January 6, 2022 19:21
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.

2 participants