-
-
Notifications
You must be signed in to change notification settings - Fork 892
Would you accept a PR to search inside archives? #1707
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
Comments
What would be the benefit of that over something like
fd's parallelization wouldn't help that much, since the archive file has to be read in series. And the ignore functionality probably isn't as useful for inspecting archives. Also, if we added support for searching zip files, we would probably also want support for tarballs (with various kinds of compression). And possibly other archive formats, such as 7zip as well. |
I think the benefit would be if you don't know exactly which |
Yes, as @tavianator says, it would be to search for a file you know exists in a directory of uncompressed and compressed files, where the file could be in either. In my case, the Downloads directory. |
There is a folder full of $ fd -V
fd 10.2.0
$ fd -z FOO
error: unexpected argument '-z' found |
@sergeevabc Something like this should work: $ fd -e tar.zst -x tar tf | grep FOO |
$ fd -e tar.zst -x tar tf | grep FOO
usr/bin/FOO File is found, good to know it exists, but I still don't know which archive it is in. Ideas? |
Oh right. Uh, I'd probably do something like this: $ fd -e tar.zst -x sh -c 'printf "\\n%s\\n" "$1" >&2 && tar tf "$1"' sh | grep FOO |
Meet zfind by @laktak. It searches for files, including inside $ zfind "name like 'cygintl-8.dll'"
cygwin\x86_64\release\gettext\libintl8\libintl8-0.22.4-1.tar.xz//usr/bin/cygintl-8.dll |
Meet WinRAR. Its search is faster than zfind and supports more archive formats, including |
Meet ugrep by @genivia-inc. It is bloody fast. $ ug -z -l -g cygintl-8.dll ""
x86_64\
╰╴release\
│ ╰╴gettext\
│ │ ╰╴libintl8\
│ │ │ ╰╴libintl8-0.22.4-1.tar.xz{usr/bin/cygintl-8.dll}
▔ ▔ ▔ |
Hello,
Would you be open to accepting a PR that searched within archives (starting with .zip files)?
This could be easily implemented using the
zip
crate, which would introduce dependencies oncrc32fast
,crossbeam-utils
(already a crossbeam dependency infd
's own),indexmap
, andmemchr
. It can obviously be gated behind a feature flag, but you'd have to figure out whether you'd want it supported by default or not (with the primary difference being how it ends up packaged by distros).The text was updated successfully, but these errors were encountered: