Just came across this excellent post: Poor mans mind mapping tool with just the terminal from @fullstackthaumaturge toot on Fosstodon. The whole premise is that you can do a lot things with the UNIX philosophy of using files for everything and manipulating them with simple tools that do one thing but do it well. So if you wanted a mindmap then just touch files in a folder hierarchy and then print it out with tree.

I found that amusing and thought, well what if you don’t want to clutter your file-system and wanted to zip up your mindmap. Would you be able to get a nice tree output without unzipping the archive? Well turns out you can do just that by piping from zipinfo to tree which supports reading from a file (instead of reading a file-system) using the --fromfile argument.

So you end up with this command:

1
zipinfo -1 mindmap.zip | tree --fromfile $1 -C -r

and this output:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
.
`-- mindmap
    |-- top
    |-- first
    |   |-- second
    |   `-- first
    `-- 2
	|-- 2
	`-- 1

3 directories, 5 files
Screenshot of the same output as the preceding code block above with terminal colors.
Pretty terminal output with colors from the '-C' flag

I’m not suggesting anyone do this, but it’s a fun example UNIX principles and pipes.