television/cable/unix-channels.toml
Alex Pasmantier ca09c503ca
refactor!(cable): update cable channel preview configuration format + add custom preview offsets (#511)
BREAKING CHANGE: the format of the cable channel files and more
specifically the preview specification is updated to be a single table
named `preview` (with keys `command`, `delimiter`, and `offset`) instead
of three flat fields.

```toml
preview_command = "echo 3"
preview_delimiter = " "
preview_offset = "{1}"
```

becomes: 

```toml
preview.command = "echo 3"
preview.delimiter = " "
preview.offset = "{1}"
```
2025-05-16 01:07:12 +02:00

93 lines
2.3 KiB
TOML

# Files
[[cable_channel]]
name = "files"
source_command = "fd -t f"
preview.command = "bat -n --color=always {}"
# Text
[[cable_channel]]
name = "text"
source_command = "rg . --no-heading --line-number"
preview.command = "bat -n --color=always {0}"
preview.delimiter = ":"
preview.offset = "{1}"
# Directories
[[cable_channel]]
name = "dirs"
source_command = "fd -t d"
preview.command = "ls -la --color=always {}"
# Environment variables
[[cable_channel]]
name = "env"
source_command = "printenv"
preview.command = "cut -d= -f2 <<< ${0} | cut -d\" \" -f2- | sed 's/:/\\n/g'"
# Aliases
[[cable_channel]]
name = "alias"
source_command = "alias"
interactive = true
# GIT
[[cable_channel]]
name = "git-repos"
# this is a MacOS version but feel free to override it to fit your needs
source_command = "fd -g .git -HL -t d -d 10 --prune ~ -E 'Library' -E 'Application Support' --exec dirname {}"
preview.command = "cd {} && git log -n 200 --pretty=medium --all --graph --color"
[[cable_channel]]
name = "git-diff"
source_command = "git diff --name-only"
preview.command = "git diff --color=always {0}"
[[cable_channel]]
name = "git-reflog"
source_command = 'git reflog'
preview.command = 'git show -p --stat --pretty=fuller --color=always {0}'
[[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 = "git-branch"
source_command = "git --no-pager branch --all --format=\"%(refname:short)\""
preview.command = 'git show -p --stat --pretty=fuller --color=always {0}'
# Docker
[[cable_channel]]
name = "docker-images"
source_command = "docker image list --format \"{{.ID}}\""
preview.command = "docker image inspect {0} | jq -C"
# S3
[[cable_channel]]
name = "s3-buckets"
source_command = "aws s3 ls | cut -d \" \" -f 3"
preview.command = "aws s3 ls s3://{0}"
# Dotfiles
[[cable_channel]]
name = "my-dotfiles"
source_command = "fd -t f . $HOME/.config"
preview.command = "bat -n --color=always {}"
# Shell history
[[cable_channel]]
name = "zsh-history"
source_command = "sed '1!G;h;$!d' ${HISTFILE:-${HOME}/.zsh_history} | cut -d\";\" -f 2-"
[[cable_channel]]
name = "bash-history"
source_command = "sed '1!G;h;$!d' ${HISTFILE:-${HOME}/.bash_history}"
[[cable_channel]]
name = "fish-history"
source_command = "fish -c 'history'"