pget icon indicating copy to clipboard operation
pget copied to clipboard

Enhancement: multifile should optionally extract tar files (-x set)

Open tempusfrangit opened this issue 2 years ago • 3 comments

multifile should opportunistically extract tar files when -x is set. This means looking at the content-type and knowing what to do.

tempusfrangit avatar Dec 10 '23 09:12 tempusfrangit

i want to work on this issue but i don't exactly get what the is the required output? Can you just brief me about it? Thank you

AtharvaWaghchoure avatar Dec 11 '23 08:12 AtharvaWaghchoure

Hi @AtharvaWaghchoure thanks for asking for clarification

The changes for this issue are fairly straight forward.

  • Need to extend the -x flag to be a persistent flag instead of a rootcmd local flag
  • Remove the guard against using the flag with multifile
  • Enhance the consumer interface for Fetch to take a content-type value (most consumers will ignore it)
  • Pass the content-type to the consumer (this is available in the http.Response

The output can run through the current tar-extractor consumer

However there are two approaches to untarring in multifile mode:

  1. New wrapper consumer for tar-extract when in multifile mode
  • This consumer can fallthrough to the standard file-writer or pass to the current tar-extractor depending on content-type
  1. enhance current tar-extractor consumer to consider the content-type (if passed) before extracting

The current code that leans on pkg/extract/tar.go to handle tar files should be sufficient for actual extraction, but we need to make it so we can extract tar files (if they exist) in multifile mode when asked to do so. Multifile mode may have multiple tar files, some tar files, or a mix of tar and non-tar files.

I am open alternate solutions to what I've typed above. If you have additional thoughts on how to better handle the tar extraction -- I'm totally open to that!

tempusfrangit avatar Dec 11 '23 15:12 tempusfrangit

Thank you for the clarification. I'll start the work on this issue now. Can you assigned this issue to me?

AtharvaWaghchoure avatar Dec 12 '23 09:12 AtharvaWaghchoure