### Install Project Dependencies Source: https://alexpasmantier.github.io/television/developers/contributing Install all necessary project dependencies using the 'just setup' command. ```bash just setup ``` -------------------------------- ### Install Television on NetBSD Source: https://alexpasmantier.github.io/television/getting-started/installation Install Television using the pkgin package manager. ```bash pkgin install television ``` -------------------------------- ### Action Syntax and Examples Source: https://alexpasmantier.github.io/television/reference/actions Demonstrates the basic syntax for defining actions in configuration files and provides examples of keybinding configurations. ```APIDOC ## Action Syntax In configuration files, actions use `snake_case`: ``` [keybindings] ctrl-j = "select_next_entry" ctrl-k = "select_prev_entry" ``` ## Example Configurations ### Vim-style Navigation ``` [keybindings] ctrl-j = "select_next_entry" ctrl-k = "select_prev_entry" ctrl-d = "select_next_page" ctrl-u = "select_prev_page" ``` > **Note:** Single character keys like `j` and `k` cannot be used for navigation as they are captured as search input. Use modifier keys (Ctrl, Alt) for navigation bindings. ### Emacs-like Input These are already the defaults: ``` [keybindings] ctrl-a = "go_to_input_start" ctrl-e = "go_to_input_end" ctrl-u = "delete_line" ctrl-w = "delete_prev_word" ``` ### Quick Actions ``` [keybindings] ctrl-y = "copy_entry_to_clipboard" ctrl-r = "reload_source" f5 = "reload_source" ``` ``` -------------------------------- ### Complete Example Configuration Source: https://alexpasmantier.github.io/television/reference/channel-spec A comprehensive example demonstrating metadata, data sources, display and output formatting, preview commands, UI layout, keybindings, and custom actions for managing Docker containers. ```toml [metadata] name = "docker-containers" description = "Manage Docker containers" requirements = ["docker"] [source] command = ["docker ps --format '{{.ID}}\t{{.Names}}\t{{.Status}}'", "docker ps -a --format '{{.ID}}\t{{.Names}}\t{{.Status}}'"] display = "{split:\t:1} | {split:\t:2}" output = "{split:\t:0}" [preview] command = "docker inspect '{split:\t:0}' | jq ." [ui] layout = "landscape" [ui.preview_panel] size = 55 header = "Container: {split:\t:1}" [keybindings] shortcut = "f5" ctrl-l = "actions:logs" ctrl-x = "actions:stop" ctrl-a = "actions:attach" [actions.logs] description = "View container logs" command = "docker logs -f '{split:\t:0}'" mode = "fork" [actions.stop] description = "Stop container" command = "docker stop '{split:\t:0}'" mode = "fork" [actions.attach] description = "Attach to container" command = "docker exec -it '{split:\t:0}' /bin/sh" mode = "execute" ``` -------------------------------- ### Install tldr (Simplified Man Pages) Source: https://alexpasmantier.github.io/television/getting-started/first-channel Install the 'tldr' utility using various package managers or npm/pip. This is a prerequisite for the tutorial. ```bash # macOS brew install tldr # Arch Linux pacman -S tldr # Using npm npm install -g tldr # Using pip pip install tldr ``` -------------------------------- ### Install Television via Scoop Source: https://alexpasmantier.github.io/television/getting-started/installation Install Television on Windows using the Scoop package manager. ```bash scoop bucket add extras scoop install television ``` -------------------------------- ### Install Television via WinGet Source: https://alexpasmantier.github.io/television/getting-started/installation Install Television on Windows using the WinGet package manager. ```bash winget install --exact --id alexpasmantier.television ``` -------------------------------- ### Install Television via Homebrew Source: https://alexpasmantier.github.io/television/getting-started/installation Install Television on macOS or Linux using Homebrew. ```bash brew install television ``` -------------------------------- ### Install Television via Crates.io Source: https://alexpasmantier.github.io/television/getting-started/installation Install Television using cargo after setting up the Rust toolchain. ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup update ``` ```bash cargo install --locked television ``` -------------------------------- ### Install Television on Chimera Linux Source: https://alexpasmantier.github.io/television/getting-started/installation Install Television using the apk package manager. ```bash apk add chimera-repo-user apk add television ``` -------------------------------- ### Install Television via Conda-forge Source: https://alexpasmantier.github.io/television/getting-started/installation Install Television using the pixi package manager. ```bash pixi global install television ``` -------------------------------- ### Install Television via Curl Source: https://alexpasmantier.github.io/television Use this command to quickly install Television on your system using curl. Ensure you have curl installed. ```bash curl -sSL https://raw.githubusercontent.com/alexpasmantier/television/refs/heads/main/install.sh | sh ``` -------------------------------- ### Install Television on Arch Linux Source: https://alexpasmantier.github.io/television/getting-started/installation Install Television using the pacman package manager. ```bash pacman -S television ``` -------------------------------- ### Real-World Examples Source: https://alexpasmantier.github.io/television/advanced/template-system Practical examples demonstrating the template system's application in common scenarios like Git log and text search. ```APIDOC ## Real-World Examples ### Git Log Channel ```toml [source] command = "git log --oneline --color=always" output = "{strip_ansi|split: :0}" # Extract commit hash ansi = true [preview] command = "git show --color=always '{strip_ansi|split: :0}'" ``` ### Text Search (ripgrep) ```toml [source] command = "rg --line-number --no-heading --color=always ." output = "{strip_ansi|split:\\::..2}" # file:line ansi = true [preview] command = "bat -H '{split:\\::1}' --color=always '{split:\\::0}'" offset = "{split:\\::1}" # Scroll to matching line ``` ``` -------------------------------- ### Real-World Examples Source: https://alexpasmantier.github.io/television/advanced/template-system Practical configurations for Git logs and text search. ```toml [source] command = "git log --oneline --color=always" output = "{strip_ansi|split: :0}" # Extract commit hash ansi = true [preview] command = "git show --color=always '{strip_ansi|split: :0}'" ``` ```toml [source] command = "rg --line-number --no-heading --color=always ." output = "{strip_ansi|split:\::..2}" # file:line ansi = true [preview] command = "bat -H '{split:\::1}' --color=always '{split:\::0}'" offset = "{split:\::1}" # Scroll to matching line ``` -------------------------------- ### Install Television on Debian-based systems Source: https://alexpasmantier.github.io/television/getting-started/installation Download and install the latest .deb package for Debian, Ubuntu, or Mint. ```bash VER=`curl -s "https://api.github.com/repos/alexpasmantier/television/releases/latest" | grep '"tag_name":' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/'` curl -LO https://github.com/alexpasmantier/television/releases/download/$VER/tv-$VER-x86_64-unknown-linux-musl.deb echo $VER sudo dpkg -i tv-$VER-x86_64-unknown-linux-musl.deb ``` -------------------------------- ### Quick Actions Keybindings Source: https://alexpasmantier.github.io/television/reference/actions Example configuration for quick actions like copying entries to the clipboard or reloading sources. ```ini [keybindings] ctrl-y = "copy_entry_to_clipboard" ctrl-r = "reload_source" f5 = "reload_source" ``` -------------------------------- ### Install Television via Nix Source: https://alexpasmantier.github.io/television/getting-started/installation Run Television directly using nixpkgs. ```bash nix run nixpkgs#television ``` -------------------------------- ### Install Television via automated script Source: https://alexpasmantier.github.io/television/getting-started/installation Use these commands to automatically detect the system and install Television. ```bash curl -fsSL https://alexpasmantier.github.io/television/install.sh | bash ``` ```bash curl -fsSL https://alexpasmantier.github.io/television/install.sh -o install.sh chmod +x install.sh ./install.sh ``` -------------------------------- ### Setup Custom Integration Directory Source: https://alexpasmantier.github.io/television/user-guide/shell-integration Create a local directory for storing customized shell integration scripts. ```bash mkdir -p ~/.config/television/shell ``` -------------------------------- ### Example Custom Theme Configuration Source: https://alexpasmantier.github.io/television/user-guide/themes Define colors for various UI elements in your custom theme TOML file. This example shows settings for general, input, results, preview, and mode elements. ```toml # general background = '#1e1e2e' border_fg = '#6c7086' text_fg = '#cdd6f4' dimmed_text_fg = '#6c7086' # input input_text_fg = '#f38ba8' result_count_fg = '#f38ba8' # results result_name_fg = '#89b4fa' result_line_number_fg = '#f9e2af' result_value_fg = '#b4befe' selection_fg = '#a6e3a1' selection_bg = '#313244' match_fg = '#f38ba8' # preview preview_title_fg = '#fab387' # modes channel_mode_fg = '#1e1e2e' channel_mode_bg = '#f5c2e7' remote_control_mode_fg = '#1e1e2e' remote_control_mode_bg = '#a6e3a1' send_to_channel_mode_fg = '#89dceb' ``` -------------------------------- ### Preview Configuration Examples Source: https://alexpasmantier.github.io/television/reference/channel-spec Defines how entries are previewed, supporting cycling commands, environment variables, line offsets, and custom headers/footers. ```toml [preview] command = "bat -n --color=always '{}'" ``` ```toml [preview] command = ["bat -n --color=always '{}'", "cat '{}'", "xxd '{}' | head -100"] # Press Ctrl+F to cycle between preview commands ``` ```toml [preview] command = "bat -n --color=always '{}'" env = { BAT_THEME = "ansi" } ``` ```toml # Entry format: "file.txt:42:content" [preview] command = "bat -H '{split:\::1}' --color=always '{split:\::0}'" offset = "{split:\::1}" # Scroll to line 42 ``` ```toml [preview] command = "bat -n --color=always '{}'" header = "File: {}" footer = "Size: $(stat -c%s '{}')" ``` -------------------------------- ### apt-packages Source: https://alexpasmantier.github.io/television/community/channels-unix List and manage installed apt packages. ```APIDOC ## apt-packages ### Description List and manage installed apt packages. ### Requirements dpkg, apt ### Actions - **remove**: Remove the selected package - **reinstall**: Reinstall the selected package ``` -------------------------------- ### Manage Apt Packages Channel Source: https://alexpasmantier.github.io/television/community/channels-unix Lists and manages installed apt packages. Requires `dpkg` and `apt` to be installed. Provides actions to remove and reinstall packages. ```toml [metadata] name = "apt-packages" description = "List and manage installed apt packages" requirements = [ "dpkg", "apt",] [source] command = "dpkg-query -W -f='${Package}\t${Version}\t${Status}\n' 2>/dev/null | grep 'install ok installed' | awk -F'\t' '{print $1, $2}'" output = "{split: :0}" [preview] command = "apt show '{split: :0}' 2>/dev/null" [actions.remove] description = "Remove the selected package" command = "sudo apt remove '{split: :0}'" mode = "execute" [actions.reinstall] description = "Reinstall the selected package" command = "sudo apt install --reinstall '{split: :0}'" mode = "execute" ``` -------------------------------- ### Preview Section Specification Source: https://alexpasmantier.github.io/television/user-guide/channels Example of the '[preview]' section, defining the preview command, environment variables, and offset extraction. ```toml [preview] command = 'bat -n --color=always {split:\::0}' env = { BAT_THEME = "ansi" } # extra envs to use when generating preview offset = '{split:\::1}' # extracts preview offset information from the entry ``` -------------------------------- ### UI Section Configuration Source: https://alexpasmantier.github.io/television/user-guide/channels Example of the '[ui]' section, configuring UI elements like scale, layout, input bar, preview panel, status bar, help panel, and remote control. ```toml [ui] ui_scale = 80 # use 80% of available screen layout = "portrait" input_bar_position = "bottom" input_header = "Search:" [ui.preview_panel] size = 40 # 40% header = "{}" # show the currently selected entry footer = "my awesome footer" scrollbar = false [ui.status_bar] separator_open = "<" separator_close = ">" [ui.help_panel] show_categories = true [ui.remote_control] show_channel_descriptions = true sort_alphabetically = true ``` -------------------------------- ### Fish Shell Channel Completion Example Source: https://alexpasmantier.github.io/television/developers/release-notes/0.15 Demonstrates how to trigger channel name completion in the Fish shell by typing 'tv' followed by a tab. ```shell tv ``` -------------------------------- ### Configure Just Recipe Selector Source: https://alexpasmantier.github.io/television/community/channels-unix Integrates the 'just' command runner to list and execute recipes. Requires the 'just' utility to be installed. ```toml [metadata] name = "just-recipes" description = "A channel to select recipes from Justfiles" requirements = [ "just",] [source] command = [ "just --summary | tr '[:blank:]' ' '",] [preview] command = "just -s {}" [keybindings] f5 = "actions:execute-recipe" [actions.execute-recipe] description = "Execute a justfile recipe" command = "just {}" mode = "execute" ``` -------------------------------- ### Source Configuration Examples Source: https://alexpasmantier.github.io/television/reference/channel-spec Various ways to define the data source for a channel, including cycling commands, ANSI support, templates, and watch intervals. ```toml [source] command = "fd -t f" ``` ```toml [source] command = ["fd -t f", "fd -t f -H", "fd -t f -H -I"] # Press Ctrl+S to cycle between commands ``` ```toml [source] command = "git log --oneline --color=always" ansi = true output = "{strip_ansi|split: :0}" # Clean output ``` ```toml [source] command = "docker ps --format '{{.ID}}\t{{.Names}}\t{{.Status}}'" display = "{split:\t:1} ({split:\t:2})" # Show: name (status) output = "{split:\t:0}" # Output: container ID ``` ```toml [source] command = "docker ps" watch = 2.0 # Reload every 2 seconds ``` ```toml [source] command = "find . -print0" entry_delimiter = "\0" # Null-byte separated ``` -------------------------------- ### Source Section Specification Source: https://alexpasmantier.github.io/television/user-guide/channels Example of the '[source]' section, defining the command, display format, and ANSI output settings. ```toml [source] command = "rg . --no-heading --line-number --colors 'match:fg:white' --colors 'path:fg:blue' --color=always" # display = "[{split:\::..2}]\t{split:\::2}" # what's displayed in the UI (incompatible with `ansi = true`) output = "{strip_ansi|split:\::..2}" ansi = true # whether the results are ANSI formatted ``` -------------------------------- ### Invoke Channel with Custom Source and Preview Commands Source: https://alexpasmantier.github.io/television/user-guide/channels Example of invoking Television with inline source and preview commands, overriding channel configurations. ```bash tv --source-command 'fd -t f .' --preview-command 'bat -n --color=always {}' --preview-size 70 ``` -------------------------------- ### Hide Panels on Startup Source: https://alexpasmantier.github.io/television/advanced/tips-and-tricks Control the visibility of panels like preview, status bar, or remote interface when tv starts. ```shell # Hide on startup (can toggle later) tv --hide-preview tv --hide-status-bar tv --hide-remote ``` -------------------------------- ### Television Configuration Directory Structure Source: https://alexpasmantier.github.io/television/user-guide/channels Example of the default directory structure for Television channels, located in the 'cable' directory within the configuration folder. ```bash /home/user/.config/television ├── config.toml └── cable ├── files.toml ├── env.toml ├── alias.toml ├── git-repos.toml └── text.toml ``` -------------------------------- ### Configure podman-containers integration Source: https://alexpasmantier.github.io/television/community/channels-unix Provides management actions for Podman containers including start, stop, restart, logs, exec, and removal. ```toml [metadata] name = "podman-containers" description = "List and manage Podman containers" requirements = [ "podman", "jq",] [source] command = [ "podman ps --format '{{.Names}}\t{{.Image}}\t{{.Status}}'", "podman ps -a --format '{{.Names}}\t{{.Image}}\t{{.Status}}'",] display = "{split:\t:0} ({split:\t:2})" output = "{split:\t:0}" [preview] command = "podman inspect '{split:\t:0}' | jq -C '.[0] | {Name, State, Config: {Image: .Config.Image, Cmd: .Config.Cmd}, NetworkSettings: {IPAddress: .NetworkSettings.IPAddress}}'" [ui] layout = "portrait" [keybindings] ctrl-s = "actions:start" f2 = "actions:stop" ctrl-r = "actions:restart" ctrl-l = "actions:logs" ctrl-e = "actions:exec" ctrl-d = "actions:remove" [actions.start] description = "Start the selected container" command = "podman start '{split:\t:0}'" mode = "fork" [actions.stop] description = "Stop the selected container" command = "podman stop '{split:\t:0}'" mode = "fork" [actions.restart] description = "Restart the selected container" command = "podman restart '{split:\t:0}'" mode = "fork" [actions.logs] description = "Follow logs of the selected container" command = "podman logs -f '{split:\t:0}'" mode = "execute" [actions.exec] description = "Execute shell in the selected container" command = "podman exec -it '{split:\t:0}' /bin/sh" mode = "execute" [actions.remove] description = "Remove the selected container" command = "podman rm '{split:\t:0}'" mode = "execute" ``` -------------------------------- ### Manage Pacman Packages Source: https://alexpasmantier.github.io/television/community/channels-unix Lists and manages installed pacman packages, with actions to remove or list files. Requires `pacman`. ```toml [metadata] name = "pacman-packages" description = "List and manage installed pacman packages" requirements = [ "pacman",] [source] command = "pacman -Q" output = "{split: :0}" [preview] command = "pacman -Qi '{split: :0}' 2>/dev/null" [actions.remove] description = "Remove the selected package" command = "sudo pacman -R '{split: :0}'" mode = "execute" [actions.files] description = "List files owned by the selected package" command = "pacman -Ql '{split: :0}' | less" mode = "execute" ``` -------------------------------- ### Zed Editor File Finder Keybinding Configuration Source: https://alexpasmantier.github.io/television/community/showcase Set up a keybinding in Zed Editor to trigger the 'File Finder' task. This example uses 'cmd-p' to open the file finder in the center terminal. ```json [ { "bindings": { // replace file_finder::Toggle "cmd-p": [ "task::Spawn", { "task_name": "File Finder", "reveal_target": "center" }, ], }, }, ] ``` -------------------------------- ### List Installed System Fonts Source: https://alexpasmantier.github.io/television/community/channels-unix Lists all installed system fonts using the `fc-list` command. Requires `fc-list` to be installed. ```toml [metadata] name = "fonts" description = "List installed system fonts" requirements = [ "fc-list",] [source] command = "fc-list --format='%{family}\n' | sort -uf" [preview] command = "fc-list '{}' --format='%{file}\n%{style}\n%{family}\n' | head -20" [ui.preview_panel] size = 70 ``` -------------------------------- ### Troubleshoot Cargo Install Failures Source: https://alexpasmantier.github.io/television/advanced/troubleshooting If 'cargo install' fails, try updating Rust using 'rustup update' and then attempt the installation again with the '--locked' flag. ```bash rustup update ``` ```bash cargo install --locked television ``` -------------------------------- ### Default Files Channel Configuration Source: https://alexpasmantier.github.io/television/user-guide/channels Example TOML file for the default 'files' channel, specifying metadata, source command, preview command, and keybindings. ```toml [metadata] name = "files" description = "A channel to select files and directories" requirements = ["fd", "bat"] [source] command = "fd -t f" [preview] command = "bat -n --color=always '{}'" env = { BAT_THEME = "ansi" } [keybindings] shortcut = "f1" ``` -------------------------------- ### Build Television from source Source: https://alexpasmantier.github.io/television/getting-started/installation Clone the repository and build the binary manually. ```bash git clone https://github.com/alexpasmantier/television.git && cd television just build release ``` ```bash alias tv=$TELEVISION_DIR/target/release/tv ``` -------------------------------- ### Show Panels on Startup Source: https://alexpasmantier.github.io/television/advanced/tips-and-tricks Force specific panels like preview or help to be visible on startup, overriding channel configuration. ```shell # Show on startup (overrides channel config) tv --show-preview tv --show-help-panel ``` -------------------------------- ### Fix Command Not Found Error Source: https://alexpasmantier.github.io/television/advanced/troubleshooting If the 'tv' command is not recognized after installation, ensure the installation directory is in your PATH and open a new shell session or source your shell configuration file. ```bash which tv ``` ```bash where tv ``` -------------------------------- ### Enable Zsh Integration Source: https://alexpasmantier.github.io/television/user-guide/shell-integration Commands to initialize and source the Television integration for Zsh. ```bash echo 'eval "$(tv init zsh)"' >> ~/.zshrc ``` ```bash source ~/.zshrc ``` -------------------------------- ### Cargo Crates Configuration Source: https://alexpasmantier.github.io/television/community/channels-unix Defines a channel to list and uninstall installed cargo crates. ```toml [metadata] name = "cargo-crates" description = "List installed cargo crates" requirements = [ "cargo",] [source] command = "cargo install --list 2>/dev/null | grep -v '^ ' | sed 's/:$//'" display = "{split: :0} {split: :1}" output = "{split: :0}" [preview] command = "cargo install --list 2>/dev/null | sed -n '/^{split: :0} /,/^[^ ]/p' | head -20" [actions.uninstall] description = "Uninstall the selected crate" command = "cargo uninstall '{split: :0}'" mode = "execute" ``` -------------------------------- ### Combine Television Features Source: https://alexpasmantier.github.io/television/advanced/tips-and-tricks Examples of composing multiple flags to achieve specific workflows. ```bash # Watch docker containers, inline, with fast selection tv docker-ps --watch 2.0 --inline --height 10 # File picker with preview, expect keys for different actions tv files --preview-size 70 --expect "ctrl-e,ctrl-o" --ui-scale 80 # Quick exact search with auto-selection tv files --input "config" --exact --select-1 ``` -------------------------------- ### Create Channel Directory and File Source: https://alexpasmantier.github.io/television/getting-started/first-channel Create the necessary directory structure for custom channels and an empty TOML file for your new channel. ```bash mkdir -p ~/.config/television/cable touch ~/.config/television/cable/tldr.toml ``` -------------------------------- ### Update Community Channels Source: https://alexpasmantier.github.io/television/user-guide/channels Command to fetch and install community-maintained channels into your local 'cable' directory. ```bash tv update-channels ``` -------------------------------- ### Define a git-log channel Source: https://alexpasmantier.github.io/television/community/contributing-channels Example TOML configuration for a channel that parses git log entries. ```toml [metadata] name = "git-log" description = "A channel to select from git log entries" requirements = ["git", "delta"] [source] command = "git log --graph --pretty=format:'%C(yellow)%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --color=always" output = "{strip_ansi|split: :1}" ansi = true [preview] command = "git show -p --stat --pretty=fuller --color=always '{strip_ansi|split: :1}' | delta" ``` -------------------------------- ### Zoxide Directory History Configuration Source: https://alexpasmantier.github.io/television/community/channels-unix Configures browsing of zoxide directory history. Requires zoxide to be installed. ```toml [metadata] name = "zoxide" description = "Browse zoxide directory history" requirements = [ "zoxide",] [source] command = "zoxide query -l" no_sort = true frecency = false [preview] command = "ls -la --color=always '{}'" [keybindings] enter = "actions:cd" ctrl-d = "actions:remove" [actions.cd] description = "Change to the selected directory" command = "cd '{}' && $SHELL" mode = "execute" [actions.remove] description = "Remove the selected directory from zoxide" command = "zoxide remove '{}'" mode = "fork" ``` -------------------------------- ### Reset Television Configuration to Defaults Source: https://alexpasmantier.github.io/television/advanced/troubleshooting Backs up the current configuration directory and triggers a fresh initialization by running the application. ```bash # Backup and remove config mv ~/.config/television ~/.config/television.bak # Run tv - which creates new default config tv files ``` -------------------------------- ### Stripping ANSI Codes Source: https://alexpasmantier.github.io/television/advanced/template-system Remove ANSI escape sequences (colors) from entries to get plain text. ```APIDOC ## Stripping ANSI Codes Remove ANSI escape sequences (colors) from entries. ```toml [source] output = "{strip_ansi}" # Clean output without color codes ``` Useful when source commands output colored text but you need plain text for further processing. ``` -------------------------------- ### TV CLI Usage Source: https://alexpasmantier.github.io/television/reference/cli Provides a general overview of how to use the tv CLI, including available commands, arguments, and options. Use this for general guidance on interacting with the tool. ```bash A very fast, portable and hackable fuzzy finder for the terminal Usage: tv [OPTIONS] [CHANNEL] [PATH] [COMMAND] Commands: list-channels Lists the available channels init Initializes shell completion ("tv init zsh") update-channels Downloads the latest collection of channel prototypes from github and saves them to the local configuration directory help Print this message or the help of the given subcommand(s) Arguments: [CHANNEL] Which channel shall we watch? Channels provide predefined configurations including source commands, preview commands, UI settings, and more. To list available channels, use the `list-channels` subcommand. To pull the latest collection of channels from github, use the `update-channels` subcommand. [PATH] The working directory to start the application in. Defaults to the current directory. Options: -h, --help Print help (see a summary with '-h') -V, --version Print version Source: -s, --source-command Source command to use for the current channel. When a channel is specified: This overrides the command defined in the channel prototype. When no channel is specified: This creates an ad-hoc channel with the given command. Example: `find . -name '*.rs'` --ansi Whether tv should extract and parse ANSI style codes from the source command output. This is useful when the source command outputs colored text or other ANSI styles and you want `tv` to preserve them in the UI. It does come with a slight performance cost but which should go mostly unnoticed for typical human interaction workloads. Example: `tv --source-command="echo -e 'Red'" --ansi` --no-sort Disable automatic sorting of entries based on match quality. This is useful when you want to preserve the original order of entries as provided by the source command. --source-display Source display template to use for the current channel. When a channel is specified: This overrides the display template defined in the channel prototype. When no channel is specified: This flag requires --source-command to be set. The template is used to format each entry in the results list. Example: `{split:/:-1}` (show only the last path segment) --source-output Source output template to use for the current channel. When a channel is specified: This overrides the output template defined in the channel prototype. When no channel is specified: This flag requires --source-command to be set. The template is used to format the final output when an entry is selected. Example: "{}" (output the full entry) --source-entry-delimiter The delimiter byte to use for splitting the source's command output into entries. This can be useful when the source command outputs multiline entries and you want to rely on another delimiter to split the entries such a null byte or a custom character. Preview: -p, --preview-command Preview command to use for the current channel. When a channel is specified: This overrides the preview command defined in the channel prototype. When no channel is specified: This enables preview functionality for the ad-hoc channel. Example: "cat {}" (where {} will be replaced with the entry) Parts of the entry can be extracted positionally using the `delimiter` option. Example: "echo {0} {1}" will split the entry by the delimiter and pass the first two fields to the command. --preview-header Preview header template When a channel is specified: This overrides the header defined in the channel prototype. When no channel is specified: This flag requires --preview-command to be set. The given value is parsed as a `MultiTemplate`. It is evaluated for every entry and its result is displayed above the preview panel. --preview-footer Preview footer template When a channel is specified: This overrides the footer defined in the channel prototype. When no channel is specified: This flag requires --preview-command to be set. ``` -------------------------------- ### Ad-hoc tv Channel with Preview Source: https://alexpasmantier.github.io/television/getting-started/quickstart Create a temporary channel with a custom source command and configure a preview command to display file content. ```bash # With preview tv --source-command "fd -t f" --preview-command "bat -n --color=always '{}'" ``` -------------------------------- ### Invoke Channel Directly from CLI Source: https://alexpasmantier.github.io/television/user-guide/channels Example of invoking a channel named 'files' directly from the command line interface. ```bash tv files ``` -------------------------------- ### Configure Preview Cycling Commands Source: https://alexpasmantier.github.io/television/advanced/tips-and-tricks Set up multiple commands for previewing files. Allows switching between syntax highlighting, raw view, or different preview tools. ```toml [preview] command = ["bat -n --color=always '{}'", "cat '{}'", "head -50 '{}'"] ``` -------------------------------- ### Build Release Version Source: https://alexpasmantier.github.io/television/developers/contributing Build a release version of the application to test production behavior. ```bash just b release ``` ```bash # or `just br` ``` ```bash # or `just build release` ``` -------------------------------- ### Run Application in Debug Mode Source: https://alexpasmantier.github.io/television/developers/contributing Start the application in debug mode for development, enabling logs and debug information. ```bash just run ``` -------------------------------- ### Enable Bash Integration Source: https://alexpasmantier.github.io/television/user-guide/shell-integration Commands to initialize and source the Television integration for Bash. ```bash echo 'eval "$(tv init bash)"' >> ~/.bashrc ``` ```bash source ~/.bashrc ``` -------------------------------- ### WiFi Network Management Configuration Source: https://alexpasmantier.github.io/television/community/channels-unix Configures scanning and connecting to WiFi networks using nmcli. Requires nmcli to be installed. ```toml [metadata] name = "wifi" description = "Scan and connect to WiFi networks" requirements = [ "nmcli",] [source] command = "nmcli -t -f SSID,SIGNAL,SECURITY device wifi list 2>/dev/null | grep -v '^:' | sort -t: -k2 -rn" display = "{split:\::0} ({split:\::1}% {split:\::2})" output = "{split:\::0}" [preview] command = "nmcli -t -f SSID,BSSID,MODE,FREQ,SIGNAL,SECURITY,ACTIVE device wifi list 2>/dev/null | grep '^{split:\::0}:'" [actions.connect] description = "Connect to the selected network" command = "nmcli device wifi connect '{split:\::0}'" mode = "execute" ``` -------------------------------- ### Validate TOML Configuration Syntax Source: https://alexpasmantier.github.io/television/advanced/troubleshooting To check for syntax errors in your TOML configuration file, install and use the 'toml-cli' validator. ```bash # Install a TOML validator pip install toml-cli toml-cli validate ~/.config/television/config.toml ``` -------------------------------- ### Create Ad-hoc tv Channels with Custom Source Source: https://alexpasmantier.github.io/television/getting-started/quickstart Define temporary channels on the fly using CLI flags to specify custom commands for sourcing data. ```bash # Custom source command tv --source-command "find . -name '*.rs'" ``` -------------------------------- ### List and Run Gradle Tasks Source: https://alexpasmantier.github.io/television/community/channels-unix Configuration for listing and running Gradle tasks. Requires gradle. ```toml [metadata] name = "gradle-tasks" description = "List and run Gradle tasks" requirements = [ "gradle",] [source] command = "gradle tasks --all -q 2>/dev/null | grep -E '^[a-zA-Z]' | awk '{print $1}' | grep -v '^-' | sort -u" [preview] command = "gradle help --task '{}' -q 2>/dev/null || echo 'Task: {}'" [keybindings] enter = "actions:run" [actions.run] description = "Run the selected Gradle task" command = "gradle '{}'" mode = "execute" ``` -------------------------------- ### Metadata Section Specification Source: https://alexpasmantier.github.io/television/user-guide/channels Example of the '[metadata]' section in a channel TOML file, including name, description, and binary requirements. ```toml [metadata] name = "text" description = "A short description about what my channel does" requirements = ["rg", "bat"] # any binary requirements my channel needs ``` -------------------------------- ### Enable Preview Word Wrap Source: https://alexpasmantier.github.io/television/advanced/tips-and-tricks Enable text wrapping within the preview panel. ```bash tv --preview-word-wrap ``` -------------------------------- ### Prefill Input with Custom Text Source: https://alexpasmantier.github.io/television/advanced/tips-and-tricks Start the search input with pre-filled text. Useful for shell integration or scripted searches. ```shell tv files --input "src/" ``` -------------------------------- ### List Global NPM Packages Source: https://alexpasmantier.github.io/television/community/channels-unix Lists globally installed npm packages and provides actions to uninstall or update them. Requires `npm`. ```toml [metadata] name = "npm-packages" description = "List globally installed npm packages" requirements = [ "npm",] [source] command = "npm list -g --depth=0 --parseable 2>/dev/null | tail -n +2 | xargs -I{} basename {}" [preview] command = "npm info '{}' 2>/dev/null | head -30" [actions.uninstall] description = "Uninstall the selected global package" command = "npm uninstall -g '{}'" mode = "execute" [actions.update] description = "Update the selected global package" command = "npm update -g '{}'" mode = "execute" ``` -------------------------------- ### Ad-hoc tv Channel with Preview Size Adjustment Source: https://alexpasmantier.github.io/television/getting-started/quickstart Configure a temporary channel with custom source and preview commands, and adjust the size of the preview panel. ```bash # Adjust preview size tv --source-command "ls -la" --preview-command "file '{}'" --preview-size 70 ``` -------------------------------- ### List Listening Ports and Processes (TOML) Source: https://alexpasmantier.github.io/television/community/channels-unix Configures a tool to list listening network ports and their associated processes. Requires 'ss' and 'awk'. ```toml [metadata] name = "ports" description = "List listening ports and associated processes" requirements = [ "ss", "awk",] [source] command = "ss -tlnp 2>/dev/null | tail -n +2 | awk '{gsub(/.*:/,\"",$4); print $4, $1, $6}' | sed 's/users:((\"//; s/\".*//'" display = "{split: :0} ({split: :2})" [preview] command = "ss -tlnp 2>/dev/null | grep ':{split: :0} ' | head -20" [ui.preview_panel] size = 40 [actions.kill] description = "Kill the process listening on the selected port" command = "fuser -k {split: :0}/tcp" mode = "execute" ``` -------------------------------- ### Configure Shell Alias Channel Source: https://alexpasmantier.github.io/television/community/channels-unix Defines a channel to select from shell aliases. No specific setup is required beyond having a shell configured. ```toml [metadata] name = "alias" description = "A channel to select from shell aliases" [source] command = "$SHELL -ic 'alias'" output = "{split:=:0}" [preview] command = "$SHELL -ic 'alias' | grep -E '^(alias )?{split:=:0}='" [ui.preview_panel] size = 30 ``` -------------------------------- ### Configure UI Scaling via Configuration File Source: https://alexpasmantier.github.io/television/advanced/tips-and-tricks Set the UI scale percentage for tv within the configuration file. The UI will be centered within the scaled area. ```toml [ui] ui_scale = 70 # 70% of terminal ``` -------------------------------- ### Minimum Required Fields for a New Channel Source: https://alexpasmantier.github.io/television/user-guide/channels Example of the minimum required fields ('name' and 'command') for a new custom channel TOML file. ```toml [metadata] name = "my-awesome-channel" [source] command = "aws s3 ls my-bucket" ``` -------------------------------- ### Configure Multiple Actions for a Keybinding Source: https://alexpasmantier.github.io/television/advanced/tips-and-tricks Bind multiple actions to a single key in the configuration file. Actions will execute in sequence. ```toml [keybindings] ctrl-r = ["reload_source", "copy_entry_to_clipboard"] ``` -------------------------------- ### Take First Result Immediately Source: https://alexpasmantier.github.io/television/advanced/tips-and-tricks Return the first entry as soon as it appears, without waiting for all results to load. This is the fastest option. ```shell tv --take-1-fast # Fastest, returns immediately ``` -------------------------------- ### Initialize Shell Integration Source: https://alexpasmantier.github.io/television/advanced/troubleshooting If Ctrl+T or Ctrl+R keybindings are not working, ensure that the 'tv init' command output has been sourced in your shell configuration and reload your shell. You can check the output of 'tv init zsh' to verify. ```bash # Check if tv init generates output tv init zsh ``` -------------------------------- ### Specify Search Directory Source: https://alexpasmantier.github.io/television/advanced/troubleshooting If no results are showing, ensure the source command is not empty and filters are not too restrictive. You can also specify a starting directory for the search. ```bash # Start in specific directory tv files /path/to/search ``` -------------------------------- ### Open Selected Files with tv Source: https://alexpasmantier.github.io/television/getting-started/quickstart Use tv to select files and then pass the selected file paths to an editor like vim. ```bash # Open selected file in editor vim $(tv files) ``` -------------------------------- ### Generate cable documentation Source: https://alexpasmantier.github.io/television/community/contributing-channels Use this command to manually generate documentation if the automated CI process fails. ```bash just generate-cable-docs ``` -------------------------------- ### Vim-style Navigation Keybindings Source: https://alexpasmantier.github.io/television/reference/actions Example configuration for Vim-style navigation using modifier keys. Single character keys are not recommended for navigation as they are captured as search input. ```ini [keybindings] ctrl-j = "select_next_entry" ctrl-k = "select_prev_entry" ctrl-d = "select_next_page" ctrl-u = "select_prev_page" ``` -------------------------------- ### Configure TLDR Help Page Browser Source: https://alexpasmantier.github.io/television/community/channels-unix This TOML configuration sets up a TLDR help page browser. It defines metadata, a command to list pages, a command to preview a selected page, and keybindings for actions like opening a page. ```toml [metadata] name = "tldr" description = "Browse and preview TLDR help pages for command-line tools" requirements = [ "tldr",] [source] command = "tldr --list" [preview] command = "tldr '{0}' --color always" [ui] layout = "portrait" [keybindings] ctrl-e = "actions:open" [actions.open] description = "Open the selected TLDR page" command = "tldr '{0}'" mode = "execute" ``` -------------------------------- ### Zed Editor Live Grep Task Configuration Source: https://alexpasmantier.github.io/television/community/showcase Configure a task in Zed Editor for 'Live Grep' using 'television'. This setup allows for project-wide searching. ```json { "label": "Live Grep", "command": "zed $(tv text)", "hide": "always", "allow_concurrent_runs": true, "use_new_terminal": true } ``` -------------------------------- ### Manage Homebrew Packages Channel Source: https://alexpasmantier.github.io/television/community/channels-unix Lists and manages Homebrew packages. Requires `brew`. Includes keybindings for upgrading (`ctrl-u`) and uninstalling (`ctrl-d`) selected packages. ```toml [metadata] name = "brew-packages" description = "List and manage Homebrew packages" requirements = [ "brew",] [source] command = [ "brew list --formula", "brew list --cask",] [preview] command = "brew info '{}'" [ui] layout = "portrait" [keybindings] ctrl-u = "actions:upgrade" ctrl-d = "actions:uninstall" [actions.upgrade] description = "Upgrade the selected package" command = "brew upgrade '{}'" mode = "execute" [actions.uninstall] description = "Uninstall the selected package" command = "brew uninstall '{}'" mode = "execute" ``` -------------------------------- ### Zed Editor File Finder Task Configuration Source: https://alexpasmantier.github.io/television/community/showcase Configure a task in Zed Editor to use 'television' for file finding. Ensure 'television' is installed and accessible in your PATH. ```json { "label": "File Finder", "command": "zed $(tv files)", "hide": "always", "allow_concurrent_runs": true, "use_new_terminal": true } ``` -------------------------------- ### List and Run NPM Scripts Source: https://alexpasmantier.github.io/television/community/channels-unix Lists and runs npm scripts defined in `package.json`. Requires `jq`. ```toml [metadata] name = "npm-scripts" description = "List and run npm scripts from package.json" requirements = [ "jq",] [source] command = "jq -r '.scripts | to_entries[] | \"\(.key)\t\(.value)\"' package.json 2>/dev/null" display = "{split:\t:0}" [preview] command = "jq -r '.scripts["{split:\t:0}"]' package.json" [keybindings] enter = "actions:run" [ui.preview_panel] size = 30 [actions.run] description = "Run the selected npm script" command = "npm run '{split:\t:0}'" mode = "execute" ``` -------------------------------- ### Tv Complex Search Query Example Source: https://alexpasmantier.github.io/television/user-guide/search-patterns Combines fuzzy, substring, prefix, and suffix matchers with negation for advanced filtering. Use this to construct intricate search queries. ```text car 'bike !^car !bike$ ``` -------------------------------- ### Manage Running Processes (TOML) Source: https://alexpasmantier.github.io/television/community/channels-unix Configures a tool to find and manage running processes. Requires 'ps' and 'awk'. Provides actions to kill, terminate, stop, and continue processes. ```toml [metadata] name = "procs" description = "A channel to find and manage running processes" requirements = [ "ps", "awk",] [source] command = "ps -e -o pid=,ucomm= | awk '{print $1, $2}'" display = "{split: :1}" output = "{split: :0}" [preview] command = "ps -p '{split: :0}' -o user,pid,ppid,state,%cpu,%mem,command | fold" [keybindings] ctrl-k = "actions:kill" f2 = "actions:term" ctrl-s = "actions:stop" ctrl-c = "actions:cont" [actions.kill] description = "Kill the selected process (SIGKILL)" command = "kill -9 {split: :0}" mode = "execute" [actions.term] description = "Terminate the selected process (SIGTERM)" command = "kill -15 {split: :0}" mode = "execute" [actions.stop] description = "Stop/pause the selected process (SIGSTOP)" command = "kill -STOP {split: :0}" mode = "fork" [actions.cont] description = "Continue/resume the selected process (SIGCONT)" command = "kill -CONT {split: :0}" mode = "fork" ``` -------------------------------- ### Invoke Custom Channel Source: https://alexpasmantier.github.io/television/user-guide/channels Command to launch Television using a newly created custom channel. ```bash tv my-awesome-channel ``` -------------------------------- ### Zed Editor Live Grep Keybinding Configuration Source: https://alexpasmantier.github.io/television/community/showcase Define a keybinding in Zed Editor to activate the 'Live Grep' task. The example uses 'space f w' to trigger the grep functionality. ```json { "bindings": { "space f w": [ "task::Spawn", { "task_name": "Live Grep", "reveal_target": "center" } ] } } ``` -------------------------------- ### Set Global Shell Override Source: https://alexpasmantier.github.io/television/developers/release-notes/0.15 Configure a default shell for all channels in '~/.config/television/config.toml'. Channel-specific settings will still take precedence. ```toml # ~/.config/television/config.toml shell = "zsh" # options: bash, zsh, fish, powershell, cmd, nu ``` -------------------------------- ### Set Up Upstream Remote Source: https://alexpasmantier.github.io/television/developers/contributing Navigate to the project directory and add the upstream remote to track changes from the original repository. ```bash cd television git remote add upstream https://github.com/alexpasmantier/television.git ```