Did you ever, like me, get frustrated when trying to peek at a snap that’s on your disk and hit the dreaded
$ less foo_bar_1.snap
"foo_bar_1.snap" may be a binary file. See it anyway?
Rejoice, for now I have wrangled lessfilter
so it’s now more like:
$ less go_1016.snap
path: "go_1016.snap"
name: go
summary: Go programming language compiler, linker, stdlib
version: 1.9.2 classic
*** Contents:
Parallel unsquashfs: Using 8 processors
6992 inodes (8233 blocks) to write
drwxr-xr-x root/root 426 2017-10-26 01:25
-rw-r--r-- root/root 41258 2017-10-26 01:23 /AUTHORS
-rw-r--r-- root/root 1576 2017-10-26 01:23 /CONTRIBUTING.md
-rw-r--r-- root/root 55577 2017-10-26 01:23 /CONTRIBUTORS
-rw-r--r-- root/root 1479 2017-10-26 01:23 /LICENSE
-rw-r--r-- root/root 1303 2017-10-26 01:23 /PATENTS
-rw-r--r-- root/root 1601 2017-10-26 01:23 /README.md
-rw-r--r-- root/root 7 2017-10-26 01:23 /VERSION
drwxr-xr-x root/root 231 2017-10-26 01:25 /api
-rw-r--r-- root/root 521 2017-10-26 01:23 /api/README
... <snip>
If you too want this awesomeness, then, open up ~/.lessfilter
in your favourite editor and add the following:
#!/bin/sh
case "$1" in
*.snap)
if [ -x "`which snap`" ]; then snap info "$1"; fi
if [ -x "`which unsquashfs`" ]; then
echo
echo '*** Contents:'; unsquashfs -ll -d '' "$1"
else echo "No unsquashfs available"; fi ;;
*)
exit 1
esac
Not forgetting to make it executable (thanks @popey) - chmod +x ~/.lessfilter
Edit: now with -ll
for filesystem attributes = more awesomeness