The kaleidoscope: URL Scheme
A URL scheme can be used to open content in Kaleidoscope from anywhere on your system. This is particularly useful for integrating with test tools like swift-snapshot-testing that run inside of Xcode.
URL Scheme Format
The basic form of a URL recognized by Kaleidoscope is very simple:
kaleidoscope://<command>?<parameters>
Commands
Kaleidoscope supports these commands:
compare or diff:
These equivalent commands will try to open files provided in parameters as a comparison. You may supply one, two, or more files. The last two will be compared initially.
clipboard or pasteboard
Add the contents of the macOS clipboard to a document. Use the label parameter to control the destination.
history
The history command expects on file in parameters and will open the Git file history of that file, in case the files is part of a git working directory.
changeset
Open the changeset for a commit specified using a parameter. See git commit identifier below.
Parameters
Parameters control overall behavior and supply the content to be used with a command. Parameters are separated by the & character.
label
The label parameter is a key=value parameter in the form label=<string>. When supplied, the value of <string> will be used as title of the document. This is useful for repeatedly sending content to the same document as before.
files
File paths can be provided in one of two formats:
As pure file path. Paths can be either absolute or use ~ to reference the user home directory. An absolute path starts with /.
As key/values pair. Here, key will be used to name the file in Kaleidoscope. This is particularly helpful when the file path is not self-explanatory, such as when supplying files generated by a tool that automatically names files. For the path itself, see above.
git commit identifier
This can either be the 8-character short or the 40-character full hash of a commit. It needs to be part of a repository that can be found in Repositories in Kaleidoscope.
Strings and paths supplied as parameters need to be URL encoded, e.g., if a file path contains a space character, it needs to be encoded as %20 in the parameter.