television/docs/design.md

1.7 KiB

Design (high-level)

Channels

Television's design is primarily based on the concept of Channels. Channels are just structs that implement the OnAir trait.

As such, channels can virtually be anything that can respond to a user query and return a result under the form of a list of entries. This means channels can be anything from conventional data sources you might want to search through (like files, git repositories, remote filesystems, environment variables etc.) to more exotic implementations that might inclue a REPL, a calculator, a web browser, search through your spotify library, your email, etc.

Television provides a set of built-in Channels that can be used out of the box (see Built-in Channels). The list of available channels will grow over time as new channels are implemented to satisfy different use cases.

Transitions

When it makes sense, Television allows for transitions between different channels. For example, you might want to start searching through git repositories, then refine your search to a specific set of files in that shortlist of repositories and then finally search through the textual content of those files.

This can easily be achieved using transitions.

Previewers

Entries returned by different channels can be previewed in a separate pane. This is useful when you want to see the contents of a file, the value of an environment variable, etc. Because entries returned by different channels may represent different types of data, Television allows for channels to declare the type of previewer that should be used. Television comes with a set of built-in previewers that can be used out of the box and will grow over time.