50 Commits

Author SHA1 Message Date
Alex Pasmantier
1957d8d6ee WIP 2025-07-27 01:01:56 +02:00
alexandre pasmantier
e3279854fd wip 2025-07-26 23:33:18 +02:00
alexandre pasmantier
c93ddeeadb feat(cli): registering transparent selection keys for tv
Fixes #468
2025-07-25 18:12:31 +02:00
LM
c8df96270a
refactor(help): more informative help panel (#668)
## 📺 PR Description

Rework the help panel to show live keybinding source information
(global, channel) instead of hard-coded entries

Before
<img width="511" height="934" alt="image"
src="https://github.com/user-attachments/assets/bea29e07-ec4a-443d-a468-be1e9f28a705"
/>

After
<img width="690" height="1355" alt="image"
src="https://github.com/user-attachments/assets/a930382b-e814-482a-a729-54ef2dc286c4"
/>

## Env

### Command

```bash
RUST_LOG=debug cargo run -q -- --cable-dir ./cable/unix --config-file ./.config/config.toml --show-help-panel --keybindings "f10 = \"toggle_help\"; f9 = \"toggle_status_bar\""
```

### Config file
```toml
[metadata]
name = "files"
description = "A channel to select files and directories"
requirements = ["fd", "bat"]

[source]
command = ["fd -t f", "fd -t f -H"]

[preview]
command = "bat -n --color=always '{}'"
env = { BAT_THEME = "ansi" }

[keybindings]
shortcut = "f1"
f9 = "toggle_preview"
f8 = "quit"
esc = false
```

## Checklist

<!-- a quick pass through the following items to make sure you haven't
forgotten anything -->

- [x] my commits **and PR title** follow the [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) format
- [x] if this is a new feature, I have added tests to consolidate the
feature and prevent regressions
- [ ] if this is a bug fix, I have added a test that reproduces the bug
(if applicable)
- [x] I have added a reasonable amount of documentation to the code
where appropriate
2025-07-25 13:16:12 +02:00
Alex Pasmantier
72c34731ec test(pty): longer delay when checking pty exit code 2025-07-25 01:43:29 +02:00
LM
39610e145d feat(config): a more expressive bindings system (#666)
## 📺 PR Description

**IMPORTANT** Due to the nature of the changes this is a backwards
incompatible change

This PR reworks the already existing Action -> Bindings system in to a
more scalable system using
- Keys -> Actions
- Events -> Actions

With the new system a key or event can execute one or more actions
sequentially, for example

```toml
[keybindings]
# Zen Mode
"f1" = ["toggle_preview", "toggle_status_bar"]
```

Exposes input edit actions that we previously hard-coded

## Checklist

<!-- a quick pass through the following items to make sure you haven't
forgotten anything -->

- [x] my commits **and PR title** follow the [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) format
- [x] if this is a new feature, I have added tests to consolidate the
feature and prevent regressions
- [ ] if this is a bug fix, I have added a test that reproduces the bug
(if applicable)
- [x] I have added a reasonable amount of documentation to the code
where appropriate
2025-07-23 21:17:42 +02:00
Alex Pasmantier
098f3f4fe4
feat: ansi-styled results with --ansi or corresponding channel option (#655)
# Examples:
## ripgrep
```toml
[metadata]
name = "text"
description = "A channel to find and select text from files"
requirements = ["rg", "bat"]

[source]
command = "rg . --no-heading --line-number --colors 'match:fg:white' --colors 'path:fg:blue' --color=always"
ansi = true
output = "{strip_ansi|split:\\::..2}"

[preview]
command = "bat -n --color=always '{strip_ansi|split:\\::0}'"
env = { BAT_THEME = "ansi" }
offset = '{strip_ansi|split:\::1}'

[ui]
preview_panel = { header = '{strip_ansi|split:\::..2}' }
```

<img width="2880" height="1620" alt="Screenshot From 2025-07-19
20-56-53"
src="https://github.com/user-attachments/assets/67055fd1-d03e-4c4b-ad82-dbc3ba8c80d4"
/>

## git-log

```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"
```

<img width="2880" height="1620" alt="Screenshot From 2025-07-19
19-17-15"
src="https://github.com/user-attachments/assets/be97ff35-8a35-4d26-ad14-afd5ece3fed6"
/>
2025-07-19 22:52:12 +02:00
Alex Flores
e809ccf686
feat(config): add support for custom input prompt in user config (#648) 2025-07-18 17:16:51 +02:00
LM
6b818b927c test: make file based testing more robust with unique identifiers (#649)
## 📺 PR Description

update all file based tests to follow a naming convention in a dedicated
testing folder to prevent clashes. Make sure all needed files are in
place before running the test

## Checklist

<!-- a quick pass through the following items to make sure you haven't
forgotten anything -->

- [x] my commits **and PR title** follow the [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) format
- [ ] if this is a new feature, I have added tests to consolidate the
feature and prevent regressions
- [ ] if this is a bug fix, I have added a test that reproduces the bug
(if applicable)
- [x] I have added a reasonable amount of documentation to the code
where appropriate
2025-07-18 01:56:21 +02:00
alexandre pasmantier
2ae95cdbb1 test: add missing test target directory to flaky tests 2025-07-14 12:59:21 +02:00
alexandre pasmantier
23f38f9bb4 test: fix flaky tests and increase frame stability timeout 2025-07-13 12:35:51 +02:00
LM
ecf05a0148
test(cli): fix some flaky tests, reinstate exact mode testing (#632)
## 📺 PR Description

Fixes #631 
Added constraints to make either mitigate or remove "flakiness" for some
tests

## Checklist

<!-- a quick pass through the following items to make sure you haven't
forgotten anything -->

- [x] my commits **and PR title** follow the [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) format
- [ ] if this is a new feature, I have added tests to consolidate the
feature and prevent regressions
- [ ] if this is a bug fix, I have added a test that reproduces the bug
(if applicable)
- [ ] I have added a reasonable amount of documentation to the code
where appropriate
2025-07-12 15:27:38 +02:00
MohMine
4e90a357e8
feat(themes): allow users to add theme overrides using their config file
Fixes #560

### Add theme color overrides in configuration file

Link to #560

### Problem

Currently, customizing television's appearance to match personal style
requires users to rebuild from source code to modify theme colors. This
creates a significant barrier for users who want to personalize their
experience without dealing with compilation and development setup.
Users who want to adjust colors for better readability, match their
terminal theme, or create custom color schemes must either:
- Modify theme files in the source code
- Rebuild the entire application
- Maintain separate theme files
This workflow is not user-friendly and prevents quick experimentation
with different color combinations.

### Solution
Added theme color overrides directly in the configuration file, allowing
users to customize any theme color without rebuilding from source. The
themes/*.toml files now serve as defaults, while the configuration file
provides overrides that take precedence.

### Key features:
- No rebuild required: Customize colors instantly through config
- Easy testing: Try different color combinations without compilation
- Theme flexibility: Mix and match colors from different themes
- Backward compatible: Existing configs continue to work unchanged
- User-friendly: Simple TOML syntax for color customization

### Usage Example

Find your config file location:
```
 Default locations:
   # Unix: ~/.config/television/config.toml
   # Windows: %APPDATA%\television\config.toml
```

Add theme overrides to your config:

```
[ui]
   theme = "catppuccin"  # or any other theme
   
   [ui.theme_overrides]
   background = "#000000"      # Pure black background for maximum contrast
   text_fg = "#00ff00"         # Bright green for main text (high visibility)
   selection_bg = "#ff00ff"    # Bright magenta for selected items (eye-catching)
   selection_fg = "#ffffff"    # Pure white text on selected items (high contrast)
   match_fg = "#ffff00"        # Bright yellow for search matches (stands out)
   border_fg = "#00ffff"       # Bright cyan for borders (neon effect)
   result_name_fg = "#ff8800"  # Bright orange for file names (warm highlight)
   result_value_fg = "#ff0080" # Bright pink for values (vibrant accent)
```


Test your changes:

```
# Run with your config
./target/release/tv --config-file ~/.config/television/config.toml
```

<img width="1420" alt="Screenshot 2025-07-08 at 08 14 42"
src="https://github.com/user-attachments/assets/90563f86-74aa-460a-a7c2-82080be3dc0b"
/>

---------

Co-authored-by: Mohamed-Amine Bousahih <mohamed-aminebousahih@pc-66.home>
Co-authored-by: Mohamed-Amine Bousahih <mohamed-aminebousahih@mohamedminesair.home>
2025-07-11 00:06:46 +02:00
alexandre pasmantier
f60b492383 test(cli): add test that validates piping tv is working as expected 2025-07-04 19:50:58 +02:00
Alex Pasmantier
8fd91633e2
refactor: more stable behavior for --inline, --width and --height (#589)
Fixes #587
2025-07-04 13:07:26 +02:00
LM
ccc12e2644
feat(tui): add special testing conditions for overlay testing (#585)
the issue was related to the starting row. And this is the same reason
we cannot test --inline, in the test env there's no way to calculate the
amount of empty lines (or I don't see it). But at least --height and
--width are testable

---------

Co-authored-by: alexandre pasmantier <alex.pasmant@gmail.com>
2025-07-03 12:07:08 +02:00
LM
4ed48ccdad
feat(ui): support for non-fullscreen UI (#578)
fixes #575
2025-07-01 23:24:00 +02:00
kapobajza
c34fa57312
feat(binary): host our own apt repo (#568)
This PR solves part of
https://github.com/alexpasmantier/television/issues/246, since hosting
our own apt repo is just the first step.

Right now it's a draft, because I put the CD code inside of the
[.github/workflows/static.yml](98a3d7b854/.github/workflows/static.yml)
file and this, most-likely, doesn't belong there. Where exactly to put
it will need to be discussed, but the requirements are:
- to start executing this code after we generate the `.deb` binary
- and to deploy the static GH pages content after we've executed this
code

I've deployed a test version of the `.deb` package to my GH pages and
you can actually already install `television` via `apt` like this:

```sh
# download the repository public key and put it in the trusted directory
curl -sS https://kapobajza.github.io/television/apt/repository-key.asc | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/television.gpg

# put the repository download link inside the apt sources list
echo "deb https://kapobajza.github.io/television/apt stable main" | sudo tee /etc/apt/sources.list.d/television.list

sudo apt update

# install the package 🚀 
sudo apt install television
```

---------

Co-authored-by: Kapobajza <kapobajza@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Alex Pasmantier <47638216+alexpasmantier@users.noreply.github.com>
Co-authored-by: alexandre pasmantier <alex.pasmant@gmail.com>
2025-06-29 23:20:43 +02:00
lalvarezt
ca5808affe fix(cli): fix parsing of arguments for autocomplete-prompt 2025-06-29 13:04:14 +02:00
alexandre pasmantier
c25a5bd75f docs: update readme and add new format docs 2025-06-28 16:59:57 +02:00
LM
42e2728269 test(cli): new cli test suite (#564)
new set of test that cover the overall functionality of the cli

---------

Co-authored-by: alexandre pasmantier <alex.pasmant@gmail.com>
2025-06-28 16:59:57 +02:00
LM
ad4e254ae6 feat(ui): new keybindings panel and status bar (#559)
Add a new keybinding manager (à la which-key helix style)

it adapts to the current mode

channel mode

![image](https://github.com/user-attachments/assets/d1748d93-d62b-4377-a4cd-9825318300e0)

remote mode

![image](https://github.com/user-attachments/assets/fa6ab776-a9bd-421c-ae75-a0b6013401fa)

Add sorting for remote entries

---------

Co-authored-by: Alex Pasmantier <alex.pasmant@gmail.com>
2025-06-28 16:56:09 +02:00
alexandre pasmantier
7067a2ba93 feat(remote): rework remote UI and add description and requirements panels 2025-06-28 16:56:09 +02:00
alexandre pasmantier
601580953a docs(tests): simple documentation for the PtyTester 2025-06-28 16:56:09 +02:00
alexandre pasmantier
a59aab67a9 test: add integration test for --watch 2025-06-28 16:56:09 +02:00
alexandre pasmantier
dd832fcfc9 test: a cleaner integration tests directory structure 2025-06-28 16:56:09 +02:00
LM
18917362be feat(cli): add watch flag to trigger reload of channels (#557)
solves #554

---------

Co-authored-by: alexandre pasmantier <alex.pasmant@gmail.com>
2025-06-28 16:56:09 +02:00
LM
2ecbc8a170 feat(cli): initial support for source and preview overrides, layout, take_1 and take_1_fast (#553)
Co-authored-by: Alex Pasmantier <alex.pasmant@gmail.com>
2025-06-28 16:56:09 +02:00
alexandre pasmantier
47b99c43d0 test(e2e): better pty tooling and more tests 2025-06-28 16:56:09 +02:00
alexandre pasmantier
b780fa1ba5 test(e2e): add proper e2e tests and pty-testing utils 2025-06-28 16:56:09 +02:00
LM
510e7b6338 feat(ui): add support for customizing input_header, preview_header and preview_footer
This PR adds support for customizing

* input_header
* preview_header
* preview_footer

all the items are of type MultiTemplate, this gives some flexibility
when showing the selected value, let's say on the preview header, if
it's long or you want only a section

---------

Co-authored-by: alexandre pasmantier <alex.pasmant@gmail.com>
2025-06-28 16:56:09 +02:00
LM
783d96bb67 feat(ui): preview size customization (#545)
This PR adds support for configuring the preview panel size through the CLI, the configuration file, and cable files.
2025-06-28 16:56:09 +02:00
alexandre pasmantier
f6dcedc196 test(e2e): fallback to a default value of 0 when failing to parse preview offset 2025-06-28 16:56:09 +02:00
alexandre pasmantier
3b57710006 test(e2e): more end to end tests 2025-06-28 16:56:09 +02:00
alexandre pasmantier
8d822cd2fc test(e2e): add e2e tests for secondary cli commands (version, init, list-channels, ...) 2025-06-28 16:56:09 +02:00
LM
415dd38c66 fix(app): honor cli no-help and no-preview (#539)
precedence should be 
cli flags > local config > global config
2025-06-28 16:56:09 +02:00
alexandre pasmantier
e76a3df776 refactor(cable)!: cable format redesign 2025-06-28 16:56:09 +02:00
Alex Pasmantier
dfbdd65107
fix(config): use the config default_channel field as a fallback when no channel is specified (#524)
Fixes #520 

fyi @lalvarezt
2025-05-26 21:16:06 +02:00
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
Alexandre Pasmantier
1a5fa5dd4c
refactor(channels): some renaming and refactoring the channels module (#503) 2025-05-11 17:00:31 +02:00
Alexandre Pasmantier
2b2654b6aa
refactor: drop TelevisionChannel enum and all associated macros (#498)
This drops the `TelevisionChannel` enum which served as a unified
interface for builtin and cable channels as well as all related macros
and the `television-derive` package.
This simplifies the code quite a lot and will improve overall
maintainability.
2025-05-06 11:18:32 +02:00
Alexandre Pasmantier
58d73dbeba
refactor!(previews): drop builtin previewers and all related code and dependencies (#495)
BREAKING CHANGE: No more builtin previews which means channels currently using `:files:` and other builtins will now need to rely on external tools (examples to come).
2025-05-06 00:07:50 +02:00
Alexandre Pasmantier
4385317e06
refactor(cable): split cable related code into separate submodules (#486)
This refactors `television/channels/cable.rs` into two additional
submodules:
- `television/channels/cable/preview.rs`
- `television/channels/cable/prototypes.rs`
2025-04-29 18:07:42 +02:00
Alexandre Pasmantier
67677fb917
refactor!: all channels are now cable channels (#479)
- tv's default channel (when lauching `tv`) is now configurable via the
`default_channel` configuration option
- add `RUST_BACKTRACE=1` and `--nocapture` to ci testing for better
debugging
- remove all builtin channels and associated glue code as well as the
`ToCliChannel` and `ToUnitChannel` derive macros
- recode all builtin channels using shell commands (along with `fd`,
`bat`, and `rg`)
- add support for interactive shell commands inside cable channels
- drop the `send_to_channel` feature until further notice (will be
reimplemented later on in a more generic and customizable way)
2025-04-27 23:50:14 +02:00
nkxxll
bbbdcb0271
feat(cli): add substring matching with --exact flag (#477)
fixes #368 

@alexpasmantier I tried to parse down the exact flag to the find method,
but I can't find an elegant way to do so because the channel creates its
own configurations for the matcher inside of the `new` method. I started
adding the exact flag to the new function of each of the channels but it
just does not seem right to do so. Do you have an idea on how to improve
the change? I would think of passing the config struct to the new
function and exposing the config of the channel for channel transitions,
but I'm not sure... 🤔

I have done it here for the stdin channel just to show you how it would
look like and it works fine😄! Looking forward to hearing your thoughts
on that 👍

ref issue: #368

---------

Co-authored-by: Alexandre Pasmantier <alex.pasmant@gmail.com>
2025-04-22 00:37:07 +02:00
Alexandre Pasmantier
5bf3d20c83
feat(cli): add a --no-help flag to allow disabling showing the help panel (#456)
This will disable the help panel and associated toggling actions
entirely. This is useful when the help panel is not needed or
when the user wants `tv` to run with a minimal interface (e.g. when
using it as a file picker for a script or embedding it in a larger
application).
2025-04-09 21:46:16 +00:00
Alexandre Pasmantier
b81873738a
feat(cli): add a --no-remote flag to lock the application on the cli-invoked channel (#455)
This will disable the remote control panel and associated actions
entirely. This is useful when the remote control is not needed or when
the user wants `tv` to run in single-channel mode (e.g. when using it as
a file picker for a script or embedding it in a larger application).
2025-04-09 19:55:12 +00:00
Alexandre Pasmantier
4892dc3c3c
feat(cli): add --select-1 cli flag to automatically select unique result (#448)
Adds a `--select-1` flag that enables `tv` to automatically select the
only result and exit when such a case appears.

Fixes #440
2025-04-06 22:00:04 +00:00
Alexandre Pasmantier
82e3f890c8
refactor(passthrough)!: drop support for unused passthrough keybindings (#446)
BREAKING CHANGE: the CLI `passthrough_keybindings` are no longer
available. This feature wasn't used anywhere to my knowledge (github
search) and was adding unnecessary complexity to the code.
2025-04-06 16:16:41 +00:00
Alexandre Pasmantier
64b2f730b3
test: more tests for cli, app, and main (#375) 2025-03-11 01:14:02 +01:00