walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
585 stars 17 forks source link

support .tgz compressed format as well #194

Closed kmmon closed 4 months ago

kmmon commented 5 months ago

There are programs that uses .tgz as part of their packaging for example helm.

$ helm create demo
Creating demo
$ helm package demo
Successfully packaged chart and saved it to: /tmp/tmp.iyPdAstMv4/demo-0.1.0.tgz

Now when I do moar demo-0.1.0.tgz I get random output containing question marks. When I rename the file to something like .tar.gz then I get the output correctly. For renaming I use the following

$ mv demo-0.1.0.tgz demo.tar.gz

But after that also I get some question marks next to file names and sometimes file names are not properly shown as well.

$ moar demo.tar.gz
  1 demo/Chart.yaml?????????????????????????????????????????????????????????????????????????????????????0000644?0000000?0000000?00000000167?145566>
  2 appVersion: 1.16.0
  3 description: A Helm chart for Kubernetes
  4 name: demo
  5 type: application
  6 version: 0.1.0
  7 ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????>
  8 # This is a YAML-formatted file.
  9 # Declare variables to be passed into your templates.

Happy to help.

walles commented 5 months ago

.tar ("tape archive") files are archives.

Being archives, they contain one or more other files in a directory structure.

moar is a tool for viewing text files one at a time.

When you open an archive using moar something.tar.gz, what would you expect moar to show or do?

Right now moar just (wrongly in this case) assumes the archive is a text file (because moar is a text file viewer) and shows the archive as a text file.

What would you like moar to do instead?

kmmon commented 4 months ago

My simple usecase is reading a helm chart in archived from. Helm archives are in tarball (.tgz) form and given moar already is capable of reading .tar.gz I would like it to work with .tgz format as well.