Skip to content

Comparing Archive Contents with Kaleidoscope

  • Florian 

Over the last few months, we’ve received several feature requests for the ability to compare the contents of archives like .zip or .jar. Indeed, an archive is really a folder full of files, a folder that happens to be compressed into a single file. So we should be able to compare archives using Kaleidoscope.

For a while, we’ve been pondering how to best add this functionality to Kaleidoscope. Why would we want to write code or include libraries for decompressing archive formats? There are several apps for macOS that are likely better than what we could implement, including Archive Utility that ships with macOS. Archive formats may look simple on the surface, but they certainly aren’t simple to work with. Can’t we rely on an existing solution instead of reinventing the wheel?

Back in Kaleidoscope 3.1, we added support for macOS Shortcuts through two initial actions to compare files and text. We didn’t see a real need for a folder comparison, and Shortcuts doesn’t really support the notion of a folder when passing data between actions.

Today we are happy to announce that, as of Kaleidoscope 3.5, comparing archives is possible, via a brand new action for Shortcuts.

Kaleidoscope actions available in Shortcuts

More than just Folders

Sometimes the solution becomes obvious, once you take a step backwards. It turns out Shortcuts is already capable of unarchiving many archive formats using a built-in Extract Archive action. We only needed to create an action that can work with the output. The Extract Archive action delivers a list of files, rather than a folder, and so we use Compare Files as Folder. And because it’s helpful to know the original archive’s name, we’ve called the new action Compare Files as Folder named Folder Name.

The flow of actions in the Shortcuts app. The Combine step is being used to feed the archive name into Kaleidoscope.

Finder Quick Action (aka Context Menu Entry)

One of the benefits of plugging into a system technology is that you inherit nice user features for free. In this case it’s a Finder Quick Action. By enabling only one checkbox, this new shortcut can be made available in the context menu of Finder. This means you can select a number of archives, open the contextual menu and select Kaleidoscope Compare Archives.

Using the Kaleidoscope Compare Archives Quick Action shortcut on 4 zip files in Finder.
The result of running the shortcut in Kaleidoscope. In this example, the archives only consist of one html file.
The selected two archives contain the same file, but that file has different content, as indicated by the blue background.
A double-click on “kaleidoscope.html” reveals the exact differences of that file within both archives.
Here we have 2 Additions, 1 Deletion, and 5 Changes.

The new Shortcut action also means you can now compare anything using Kaleidoscope that can be made a list of files (possibly containing folders). We’d bet there are more good use cases for this. Can you think of one? Please share your experience!

Get the Shortcut

After downloading and installing Kaleidoscope 3.5, you can add the Kaleidoscope Compare Archives shortcut to your collection.

Developers should embrace Shortcuts!

If you’re a developer, we encourage you to take a closer look at supporting Shortcuts. It’s fairly simple to expose some core functionality of your app, and the resulting benefits to your users can be impressive. Things will get even better when more apps on macOS adopt the technology. Not every integration makes sense. For Kaleidoscope, supporting Siri hasn’t seemed worthwhile, as we haven’t been able to identify a reasonable use case. But supporting this new kind of scripting is quite powerful, as you can see.

In our case, we came up with a rather simple intents definition, and then wrote three simple classes of glue code to hook up the intents to the functionality. Feel free to contact us if you need a few pointers to get started. We’re happy to help!