### Install tldr Source: https://github.com/alexpasmantier/television/blob/main/docs/getting-started/03-first-channel.md Install the 'tldr' utility, which is used as an example throughout this tutorial. Choose the installation method appropriate for your operating system. ```sh # macOS brew install tldr ``` ```sh # Arch Linux pacman -S tldr ``` ```sh # Using npm npm install -g tldr ``` ```sh # Using pip pip install tldr ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/alexpasmantier/television/blob/main/docs/developers/contributing.md Install all necessary project dependencies using the 'just setup' command. ```shell just setup ``` -------------------------------- ### Run the Development Server Source: https://github.com/alexpasmantier/television/blob/main/website/CONTRIBUTING.md Starts the development server to preview changes. Ensure dependencies are installed first. ```bash pnpm start ``` -------------------------------- ### Install with Scoop Source: https://github.com/alexpasmantier/television/wiki/Installation Add the 'extras' bucket and install television using Scoop on Windows. ```bash scoop bucket add extras scoop install television ``` -------------------------------- ### Install from Crates.io Source: https://github.com/alexpasmantier/television/wiki/Installation Install the latest stable Rust toolchain and then install television using cargo. ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup update ``` ```bash cargo install --locked television ``` -------------------------------- ### Install Rust Toolchain Source: https://github.com/alexpasmantier/television/blob/main/docs/getting-started/01-installation.md Setup the latest stable Rust toolchain using rustup, which is required for building from source or installing via Cargo. ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup update ``` -------------------------------- ### Example Channel Configuration (TOML) Source: https://github.com/alexpasmantier/television/blob/main/docs/community/contributing-channels.md This TOML file defines a new channel named 'git-log' with metadata, source command, and preview command. It requires 'git' and 'delta' to be installed. ```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" ``` -------------------------------- ### Install via Pkgin (NetBSD) Source: https://github.com/alexpasmantier/television/blob/main/docs/getting-started/01-installation.md Install Television using the Pkgin package manager on NetBSD. ```bash pkgin install television ``` -------------------------------- ### Install with WinGet Source: https://github.com/alexpasmantier/television/wiki/Installation Install television using the WinGet package manager on Windows. ```powershell winget install --exact --id alexpasmantier.television ``` -------------------------------- ### Complete Channel Configuration Example Source: https://github.com/alexpasmantier/television/blob/main/docs/reference/03-channel-spec.md A comprehensive example demonstrating metadata, data sources, UI layout, keybindings, and custom actions for managing Docker containers. ```toml [metadata] name = "docker-containers" description = "Manage Docker containers" requirements = ["docker"] [source] command = [ { name = "Running", run = "docker ps --format '{{.ID}}\t{{.Names}}\t{{.Status}}'" }, { name = "All", run = "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" ``` -------------------------------- ### Quick Install Script Source: https://github.com/alexpasmantier/television/blob/main/docs/getting-started/01-installation.md Use this command for an automatic installation that detects your system. Inspect the script first by downloading it before execution. ```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 ``` -------------------------------- ### Install with Homebrew Source: https://github.com/alexpasmantier/television/wiki/Installation Install television using the Homebrew package manager on macOS and Linux. ```bash brew install television ``` -------------------------------- ### Show Help Panel on Startup Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/02-tips-and-tricks.md Use the --show-help-panel flag to ensure the help panel is displayed when tv starts. ```sh tv --show-help-panel ``` -------------------------------- ### Install with Nix Source: https://github.com/alexpasmantier/television/wiki/Installation Use Nix to run the television package directly. ```bash nix run nixpkgs#television ``` -------------------------------- ### Install with Pacman (Arch Linux) Source: https://github.com/alexpasmantier/television/wiki/Installation Install television using the pacman package manager on Arch Linux. ```bash pacman -S television ``` -------------------------------- ### Install with Apk (Chimera Linux) Source: https://github.com/alexpasmantier/television/wiki/Installation Install television using the apk package manager on Chimera Linux. ```bash apk add chimera-repo-user apk add television ``` -------------------------------- ### Install Mise and Set Up Environment Source: https://github.com/alexpasmantier/television/blob/main/docs/developers/contributing.md Instructions for installing Mise on Arch Linux or via curl, and activating it in your shell. This is a prerequisite for managing project-specific toolchains. ```shell # Arch: `sudo pacman -S mise`, or: curl https://mise.run | sh echo 'eval "$(mise activate zsh)"' >> ~/.zshrc && exec zsh mise install ``` -------------------------------- ### Install Television using Curl Source: https://github.com/alexpasmantier/television/blob/main/docs/intro.md Use this command to quickly install Television on your system via a curl script. Ensure you have curl installed. ```bash curl -sSL https://raw.githubusercontent.com/alexpasmantier/television/refs/heads/main/install.sh | sh ``` -------------------------------- ### Install with Pixi (Conda-forge) Source: https://github.com/alexpasmantier/television/wiki/Installation Install television globally using pixi, compatible with Conda-forge environments. ```bash pixi global install television ``` -------------------------------- ### Install Television via Cargo Source: https://github.com/alexpasmantier/television/blob/main/README.md Install Television using the Cargo package manager. ```shell cargo install television ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/alexpasmantier/television/blob/main/website/CONTRIBUTING.md Installs all necessary project dependencies using pnpm. This should be run after enabling corepack. ```bash pnpm install ``` -------------------------------- ### Install Project Dependencies with Mise Source: https://github.com/alexpasmantier/television/blob/main/docs/developers/contributing.md Use this command to install the correct toolchain versions specified in the project's mise.toml file. This ensures compatibility, especially for dependencies like libghostty-vt-sys which require a specific Zig version. ```shell mise install ``` -------------------------------- ### Install Debian-based Package Source: https://github.com/alexpasmantier/television/wiki/Installation Download and install the latest .deb package for Debian-based systems. ```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 ``` -------------------------------- ### Build Television from Source Source: https://github.com/alexpasmantier/television/blob/main/docs/getting-started/01-installation.md Clone the repository and build the release version of Television from source to get the latest updates from the main branch. ```bash git clone https://github.com/alexpasmantier/television.git && cd television just build release ``` -------------------------------- ### Install Debian/Ubuntu Package Source: https://github.com/alexpasmantier/television/blob/main/docs/getting-started/01-installation.md Download and install the latest .deb package for Debian-based systems. This script fetches the latest release version dynamically. ```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 ``` -------------------------------- ### Install via Cargo Source: https://github.com/alexpasmantier/television/blob/main/docs/getting-started/01-installation.md Install Television using Cargo, the Rust package manager, after setting up the Rust toolchain. ```bash cargo install --locked television ``` -------------------------------- ### Preview Section Example Source: https://github.com/alexpasmantier/television/blob/main/docs/user-guide/01-channels.md Defines the command to generate previews for search results, including 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 ``` -------------------------------- ### Get Help Source: https://github.com/alexpasmantier/television/blob/main/docs/reference/01-cli.md Prints the main help message or the help for a specific subcommand. ```bash tv help ``` -------------------------------- ### Source Section Example Source: https://github.com/alexpasmantier/television/blob/main/docs/user-guide/01-channels.md Configures the search source, including the command, output formatting, and whether to interpret ANSI escape codes. ```toml [source] command = "rg . --no-heading --line-number --colors 'match:fg:white' --colors 'path:fg:blue' --color=always" # display = "[{split:\::..2}] {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 ``` -------------------------------- ### Start tv in Specific Directory Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/03-troubleshooting.md If no results are showing, it might be due to the working directory. Use this command to explicitly start tv in a desired path. ```shell # Start in specific directory tv files /path/to/search ``` -------------------------------- ### Configure Homebrew Package Listing Source: https://github.com/alexpasmantier/television/wiki/Cable-channels Sets up a cable channel to list installed Homebrew packages and their versions, with a preview for package information. ```toml [[cable_channel]] name = "Brew list" source_command = 'brew list --versions' preview_command = 'brew info {0}' ``` -------------------------------- ### Hide Preview Panel on Startup Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/02-tips-and-tricks.md Use the --hide-preview flag to ensure the preview panel is not visible when tv starts. ```sh tv --hide-preview ``` -------------------------------- ### Configure Shell Integration Channel Triggers (Custom Example) Source: https://github.com/alexpasmantier/television/wiki/Shell-Autocompletion This TOML configuration shows a custom example of channel triggers. It maps specific commands to channels like 'git-branches', 'dirs', and 'files'. ```toml [shell_integration.channel_triggers] "git-branches" = ["git checkout"] "dirs" = ["ls"] "files" = ["cat", "nano"] ``` -------------------------------- ### Combine Features for Specific Use Cases Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/02-tips-and-tricks.md Examples demonstrating how to combine various Television CLI features for common tasks like watching Docker containers, using a file picker, or performing quick searches. ```sh # 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 ``` -------------------------------- ### Immediately Take the First Result Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/02-tips-and-tricks.md Use --take-1-fast for the quickest way to get the first entry as soon as it appears, without waiting for full loading. ```sh tv files --take-1-fast # Fastest, returns immediately ``` -------------------------------- ### UI Section Example Source: https://github.com/alexpasmantier/television/blob/main/docs/user-guide/01-channels.md Customizes the user interface, including scaling, layout, input bar position, and header text. ```toml [ui] ui_scale = 80 # use 80% of available screen layout = "portrait" input_bar_position = "bottom" input_header = "Search:" ``` -------------------------------- ### Metadata Section Example Source: https://github.com/alexpasmantier/television/blob/main/docs/user-guide/01-channels.md Defines general channel information, including its name, a description, and any binary requirements. ```toml [metadata] name = "text" description = "A short description about what my channel does" requirements = ["rg", "bat"] # any binary requirements my channel needs ``` -------------------------------- ### Configure Snap Package Listing Source: https://github.com/alexpasmantier/television/blob/main/docs/community/channels-unix.md Lists and manages installed Snap packages. Requires the 'snap' command. ```toml [metadata] name = "snap" description = "List and manage Snaps" requirements = [ "snap",] [source] output = "{split: :0}" [[source.command]] name = "Running" run = "snap list | tail -n +2" [[source.command]] name = "All" run = "snap list --all | tail -n +2" [preview] command = "snap info '{split: :0}'" [ui] layout = "portrait" [ui.preview_panel] header = "{split: :0}" ``` -------------------------------- ### Manage Apt Packages Source: https://github.com/alexpasmantier/television/blob/main/docs/community/channels-unix.md Lists and manages installed apt packages. Requires 'dpkg' and 'apt'. Supports removing and reinstalling 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' ' '{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" ``` -------------------------------- ### List Global NPM Packages Source: https://github.com/alexpasmantier/television/blob/main/docs/community/channels-unix.md Lists globally installed npm packages. Uses `npm list` to get package information and `basename` to extract names. Previews package details with `npm info`. ```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" ``` -------------------------------- ### Complex Search Query Example Source: https://github.com/alexpasmantier/television/wiki/Search-patterns Demonstrates how to combine multiple search patterns to create a complex query. This query searches for entries that fuzzy match 'car', contain the exact substring 'bike', do not start with 'car', and do not end with 'bike'. ```text car 'bike !^car !bike$ ``` -------------------------------- ### Troubleshoot Cargo Install Failures Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/03-troubleshooting.md If `cargo install television` fails, try updating your Rust installation and then attempting the install with the `--locked` flag. ```shell # Update Rust rustup update # Try with --locked flag cargo install --locked television ``` -------------------------------- ### Installed System Fonts TOML Configuration Source: https://github.com/alexpasmantier/television/blob/main/docs/community/channels-unix.md Configures a channel to list installed system fonts. 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 ``` -------------------------------- ### Build from Source Source: https://github.com/alexpasmantier/television/wiki/Installation Clone the repository, build the release version, and optionally alias the binary. ```bash git clone git@github.com:alexpasmantier/television.git && cd television just build release ``` ```bash alias tv=$TELEVISION_DIR/target/release/tv ``` -------------------------------- ### Show Preview Panel on Startup Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/02-tips-and-tricks.md Use the --show-preview flag to force the preview panel to be visible on startup, overriding channel configuration. ```sh tv --show-preview ``` -------------------------------- ### Build Channels On-the-Fly with CLI Source: https://github.com/alexpasmantier/television/blob/main/docs/developers/release-notes/0.12.md Demonstrates how to create channels dynamically using the command-line interface, specifying source and preview commands. ```sh tv --source-command "find . -name '*.rs'" \ --preview-command "bat -n --color=always '{}'" \ --preview-size 70 ``` -------------------------------- ### Enable Corepack for pnpm Source: https://github.com/alexpasmantier/television/blob/main/website/CONTRIBUTING.md Installs and enables pnpm, the project's package manager. Requires corepack to be installed. ```bash corepack enable ``` -------------------------------- ### Build for Release Source: https://github.com/alexpasmantier/television/blob/main/CONTRIBUTING.md Build the project for a production-like release environment. ```shell just b release ``` ```shell # or `just br` ``` ```shell # or `just build release` ``` -------------------------------- ### List Installed Cargo Crates with TOML Source: https://github.com/alexpasmantier/television/blob/main/docs/community/channels-unix.md Configure listing of installed Cargo crates and an uninstall action. Requires the 'cargo' command. ```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" ``` -------------------------------- ### Initialize Shell Completion Source: https://github.com/alexpasmantier/television/blob/main/docs/reference/01-cli.md Set up shell completion for Television. Replace 'zsh' with your shell if different. ```bash tv init zsh ``` -------------------------------- ### List Installed Python Packages with pip-packages.toml Source: https://github.com/alexpasmantier/television/blob/main/docs/community/channels-unix.md This snippet lists installed Python packages using 'pip'. It provides actions to upgrade and uninstall selected packages, with previews showing package details. ```toml [metadata] name = "pip-packages" description = "List installed Python packages" requirements = [ "pip",] [source] command = "pip list --format=freeze 2>/dev/null | cut -d= -f1" [preview] command = "pip show '{}'" [ui] layout = "portrait" [keybindings] ctrl-u = "actions:upgrade" ctrl-d = "actions:uninstall" [actions.upgrade] description = "Upgrade the selected package" command = "pip install --upgrade {}" mode = "execute" [actions.uninstall] description = "Uninstall the selected package" command = "pip uninstall {}" mode = "execute" ``` -------------------------------- ### Check tv Shell Integration Initialization Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/03-troubleshooting.md Verify that the `tv init` command output is correctly sourced in your shell configuration. This command shows the output that should be evaluated. ```shell # Check if tv init generates output tv init zsh ``` -------------------------------- ### List Available 'just' Commands Source: https://github.com/alexpasmantier/television/blob/main/docs/developers/contributing.md View all predefined commands available for simplifying development tasks. This helps in understanding the available shortcuts. ```shell just --list ``` -------------------------------- ### Launch Custom Channel Source: https://github.com/alexpasmantier/television/blob/main/docs/user-guide/01-channels.md Invoke your newly created custom channel from the command line. ```sh tv my-awesome-channel ``` -------------------------------- ### Launch Television Source: https://github.com/alexpasmantier/television/blob/main/docs/getting-started/02-quickstart.md Launches tv with the default channel (usually files) to start searching. ```sh tv ``` -------------------------------- ### Regex Replace Example Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/01-template-system.md Replace patterns in a string using `{regex_replace:PATTERN:REPLACEMENT}`. ```toml {regex_replace:\s+:_} # "hello world" -> "hello_world" ``` -------------------------------- ### Configure Multiple Preview Commands Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/02-tips-and-tricks.md Set up different commands for preview cycling in the configuration. The '{}' placeholder is used for the current file. ```toml [preview] command = ["bat -n --color=always '{}'", "cat '{}'", "head -50 '{}'"] ``` -------------------------------- ### UI Help Panel Configuration Source: https://github.com/alexpasmantier/television/blob/main/docs/user-guide/01-channels.md Configures the help panel, including whether to show categories. ```toml [ui.help_panel] show_categories = true ``` -------------------------------- ### Case Transformation Examples Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/01-template-system.md Transform text case using `{upper}`, `{lower}`, or `{capitalize}` operations. ```toml {upper} ``` ```toml {lower} ``` ```toml {capitalize} ``` -------------------------------- ### Generate Cable Documentation Source: https://github.com/alexpasmantier/television/blob/main/docs/community/contributing-channels.md Run this command to manually generate documentation for cable channels if the CI process fails. ```sh just generate-cable-docs ``` -------------------------------- ### Flatpak Applications TOML Configuration Source: https://github.com/alexpasmantier/television/blob/main/docs/community/channels-unix.md Configures a channel to list and manage Flatpak applications. Requires 'flatpak' to be installed. ```toml [metadata] name = "flatpak" description = "List and manage Flatpak applications" requirements = [ "flatpak",] [source] command = "flatpak list --app --columns=application,name,version 2>/dev/null" display = "{split:\t:1} ({split:\t:2})" output = "{split:\t:0}" [preview] command = "flatpak info '{split:\t:0}' 2>/dev/null" [actions.run] description = "Launch the selected application" command = "flatpak run '{split:\t:0}'" mode = "execute" [actions.uninstall] description = "Uninstall the selected application" command = "flatpak uninstall '{split:\t:0}'" mode = "execute" [actions.update] description = "Update the selected application" command = "flatpak update '{split:\t:0}'" mode = "execute" ``` -------------------------------- ### Use Specific Node Version Source: https://github.com/alexpasmantier/television/blob/main/website/CONTRIBUTING.md Ensures the correct Node.js version is used for development. Requires nvm to be installed. ```bash nvm use ``` -------------------------------- ### Quick Actions Keybindings Source: https://github.com/alexpasmantier/television/blob/main/docs/reference/02-actions.md Configure keybindings for common quick actions like copying to clipboard and reloading sources. ```toml [keybindings] ctrl-y = "copy_entry_to_clipboard" ctrl-r = "reload_source" f5 = "reload_source" ``` -------------------------------- ### Configure Pacman Package Listing Source: https://github.com/alexpasmantier/television/wiki/Cable-channels Defines a cable channel for listing installed Pacman packages and viewing their information. ```toml [[cable_channel]] name = "pacman-pkgs" source_command = "pacman -Qe" preview_command = "pacman -Qi {0}" ``` -------------------------------- ### Basic Television Commands Source: https://github.com/alexpasmantier/television/blob/main/README.md Use these commands to quickly start searching with Television. The default channel searches files. ```shell tv # Search files (default channel) tv text # Search file contents tv git-repos # Find git repositories tv --help # See all options ``` -------------------------------- ### Multi-Select and Open Files Source: https://github.com/alexpasmantier/television/blob/main/docs/getting-started/02-quickstart.md Demonstrates selecting multiple files using Tab and then opening them in an editor. ```sh nvim $(tv files) ``` -------------------------------- ### Combine Search Patterns Source: https://github.com/alexpasmantier/television/blob/main/docs/getting-started/02-quickstart.md Example of combining multiple search patterns (fuzzy, prefix, negation) for precise filtering. ```sh test ^src !.bak$ ``` -------------------------------- ### Build for Production Release Source: https://github.com/alexpasmantier/television/blob/main/docs/developers/contributing.md Build the application for a production release. This command simulates production behavior for testing. ```shell just b release ``` -------------------------------- ### Trimming Whitespace Examples Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/01-template-system.md Remove leading and/or trailing whitespace using `{trim}`, `{trim_start}`, or `{trim_end}` operations. ```toml {trim} ``` ```toml {trim_start} ``` ```toml {trim_end} ``` -------------------------------- ### List and Preview AWS S3 Buckets Source: https://github.com/alexpasmantier/television/blob/main/docs/community/channels-unix.md Lists and previews AWS S3 buckets. Requires the 'aws' CLI. Supports listing objects and human-readable summaries. ```toml [metadata] name = "aws-buckets" description = "List and preview AWS S3 Buckets" requirements = [ "aws",] [source] command = "aws s3 ls --output text" output = "{split: :3|trim}" [preview] command = "aws s3 ls s3://{split: :3|trim} --human-readable --summarize" [ui] layout = "portrait" [ui.preview_panel] size = 60 [actions.list] description = "List all objects in the selected bucket" command = "aws s3 ls s3://{split: :3|trim} --recursive --human-readable | less" mode = "execute" ``` -------------------------------- ### Emacs Keybinding Configuration Source: https://github.com/alexpasmantier/television/blob/main/docs/user-guide/03-keybindings.md This is an example of an Emacs-style keybinding configuration. These bindings are configurable via the application's configuration file. ```toml ``` -------------------------------- ### Select Dotfiles with fd and bat Source: https://github.com/alexpasmantier/television/blob/main/docs/community/channels-windows.md This channel selects files from your user's AppData\Roaming directory using `fd` and previews them with `bat`. Requires `fd` and `bat`. ```toml [metadata] name = "dotfiles" description = "A channel to select from your user's dotfiles" requirements = [ "fd", "bat",] [source] command = "fd -t f . \"$env:USERPROFILE\AppData\Roaming\"" [preview] command = "bat -n --color=always -- '{}'" ``` -------------------------------- ### Alias tv to Built Binary Source: https://github.com/alexpasmantier/television/blob/main/docs/getting-started/01-installation.md Create an alias for the 'tv' command to point to the built binary in the target release directory. ```bash alias tv=$TELEVISION_DIR/target/release/tv ``` -------------------------------- ### Padding Operation Example Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/01-template-system.md Pad strings to a specific width with a character and direction using `{pad:WIDTH:CHAR:DIRECTION}`. ```toml {pad:10:0:left} # "42" becomes "0000000042" ``` ```toml {pad:10: :center} # "foo" becomes " foo " ``` -------------------------------- ### List and Manage Podman Containers with podman-containers.toml Source: https://github.com/alexpasmantier/television/blob/main/docs/community/channels-unix.md This configuration manages Podman containers, allowing users to list running or all containers, and perform actions like starting, stopping, restarting, viewing logs, executing commands, and removing containers. It requires 'podman' and 'jq'. ```toml [metadata] name = "podman-containers" description = "List and manage Podman containers" requirements = [ "podman", "jq",] [source] display = "{split:\t:0} ({split:\t:2})" output = "{split:\t:0}" [[source.command]] name = "Running" run = "podman ps --format '{{.Names}}\t{{.Image}}\t{{.Status}}'" [[source.command]] name = "All" run = "podman ps -a --format '{{.Names}}\t{{.Image}}\t{{.Status}}'" [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" ``` -------------------------------- ### Set Up Upstream Remote Source: https://github.com/alexpasmantier/television/blob/main/docs/developers/contributing.md Navigate to the project directory and set up the upstream remote to track changes from the original repository. ```shell cd television git remote add upstream https://github.com/alexpasmantier/television.git ``` -------------------------------- ### Keybindings Configuration Source: https://github.com/alexpasmantier/television/blob/main/docs/user-guide/01-channels.md Define keyboard shortcuts for switching channels or triggering actions. Use 'f1' for direct channel switching or 'esc'/'ctrl-c' for quitting. ```toml [keybindings] shortcut = "f1" # `f1` will automatically switch to this channel quit = ["esc", "ctrl-c"] select_next_entry = ["down", "ctrl-j"] select_prev_entry = ["up", "ctrl-k"] confirm_selection = "enter" ``` -------------------------------- ### Launch in Basic Inline Mode Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/02-tips-and-tricks.md Use the --inline flag to display tv as an inline element at the bottom of the terminal. ```sh tv --inline ``` -------------------------------- ### Configure Snap Service Management Source: https://github.com/alexpasmantier/television/blob/main/docs/community/channels-unix.md Manages Snap services, including starting, stopping, restarting, and viewing logs. Requires the 'snap' command. ```toml [metadata] name = "snap-services" description = "Show details of Snap services" requirements = [ "snap",] [source] output = "{split: :0}" [[source.command]] name = "User" run = "snap services --user | tail -n +2" [[source.command]] name = "Global" run = "snap services --global | tail -n +2" [preview] command = "snap services '{split: :0}'" [ui] layout = "portrait" [keybindings] ctrl-u = "actions:start" ctrl-d = "actions:stop" ctrl-r = "actions:restart" ctrl-l = "actions:logs" [ui.preview_panel] header = "{split: :0}" [actions.start] description = "Start the selected service" command = "snap start '{split: :0}'" mode = "fork" [actions.stop] description = "Stop the selected service" command = "snap stop '{split: :0}'" mode = "fork" [actions.restart] description = "Restart the selected service" command = "snap restart '{split: :0}'" mode = "fork" [actions.logs] description = "View logs of the selected service" command = "snap logs '{split: :0}'" mode = "execute" ``` -------------------------------- ### Configure Guix Package Listing Source: https://github.com/alexpasmantier/television/wiki/Cable-channels Sets up a cable channel to list available Guix packages and show package details. ```toml [[cable_channel]] name = "guix-packages" source_command = "guix package --list-available=.* | cut -f 1 | tr -d [:blank:]" preview_command = "guix package --show={0}" ``` -------------------------------- ### Basic Command Templating Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/01-template-system.md Use templates to dynamically construct commands, such as displaying process information or killing a process by its PID. ```toml [source] command = "ps aux" display = "{split: :..3}" # Show PID, user, command [actions.kill] command = "kill -9 '{split: :0}'" # Kill by PID ``` -------------------------------- ### Regex Extract Examples Source: https://github.com/alexpasmantier/television/blob/main/docs/advanced/01-template-system.md Extract substrings using regular expressions with `{regex_extract:PATTERN}` or specify a capture group with `{regex_extract:PATTERN:GROUP}`. ```toml # Extract numbers {regex_extract:\d+} # "file123.txt" -> "123" ``` ```toml # Extract capture group {regex_extract:v(\d+):1} # "v2.3.4" -> "2" ```