Skip to content
Alexandre Pasmantier edited this page Dec 16, 2024 · 8 revisions

Tired of broadcast television? Want to watch your favorite shows on demand? television has you covered with cable channels. Cable channels are channels that are not built-in to television but are instead provided by the community.

Installing cable channels is as simple as creating provider files in your configuration folder.

A provider file is a *channels.toml file that contains cable channel prototypes defined as follows:

my-custom-channels.toml

[[cable_channel]]
name = "git-log"
source_command = 'git log --oneline --date=short --pretty="format:%h %s %an %cd" "$@"'
preview_command = 'git show -p --stat --pretty=fuller --color=always {0}'

[[cable_channel]]
name = "my-dotfiles"
source_command = 'fd -t f . $HOME/.config'
preview_command = 'bat -n --color=always {0}'

This would add two new cable channels to television available:

  • through the cli tv my-dotfiles or tv git-log
  • using the remote control mode as shown below

cable channels

Deciding which part of the source command output to pass to the previewer:

By default, each line of the source command can be passed to the previewer using {}.

If you wish to pass only a part of the output to the previewer, you may do so by specifying the preview_delimiter to use as a separator and refering to the desired part using the corresponding index.

Example:

[[cable_channel]]
name = "Disney channel"
source_command = 'echo "one:two:three:four" && echo "five:six:seven:eight"'
preview_command = 'echo {2}'
preview_delimiter = ':'
# which will pass "three" and "seven" to the preview command

General purpose

Git

logs
[[cable_channel]]
name = "git-log"
source_command = 'git log --oneline --date=short --pretty="format:%h %s %an %cd" "$@"'
preview_command = 'git show -p --stat --pretty=fuller --color=always {0}'
Screenshot 2024-12-07 at 13 16 24
branches
[[cable_channel]]
name = "git-branch"
source_command = 'git --no-pager branch --all --format="%(refname:short)"'
preview_command = 'git show -p --stat --pretty=fuller --color=always {0}'
Screenshot 2024-12-07 at 13 40 13
files
[[cable_channel]]
name = "git-files"
source_command = 'git ls-files'
preview_command = 'bat -n --color=always {}'
reflog
[[cable_channel]]
name = "git-reflog"
source_command = 'git reflog'
preview_command = 'git show -p --stat --pretty=fuller --color=always {0}'

Docker

images
[[cable_channel]]
name = "docker-images"
source_command = 'docker image list --format "{{.ID}} {{.Repository}}\t{{.Tag}}\t{{.Size}}"'
preview_command = 'docker image inspect {0} | jq -C'

S3

buckets
[[cable_channel]]
name = "s3-buckets"
source_command = 'aws s3 ls | cut -d " " -f 3'
preview_command = 'aws s3 ls s3://{0}'

MacOS-specific

Homebrew

brew list
[[cable_channel]]
name = "Brew list"
source_command = 'brew list --versions'
preview_command = 'brew info {0}'
Screenshot 2024-12-07 at 14 20 25

Linux-specific

🚧 In construction 🚧

Windows-specific

🚧 In construction 🚧

Clone this wiki locally