This commit is contained in:
Joakim
2026-10-13 10:48:28 +02:00
parent e1836a38e1
commit 6e7b3cb7ed
5 changed files with 364 additions and 16 deletions

View File

@@ -232,3 +232,44 @@ The example configuration is in `tui/example.tui`.
Use `tui -v` or `tui --version` to verify the installed TUI version.
## v3 menu
Press `M` to open the action menu. The menu is generated entirely from the current `.tui` file, so a directory can provide its own context-specific operations.
The example configuration defines ordinary file operations and Git operations that appear when the current directory is inside a Git worktree.
The top-level keys are also configurable in `.tui`:
```yaml
keys:
a: toggle-all
q: quit
m: menu
```
Menu entries support:
```yaml
menu:
- label: "Git: pull"
key: p
action: git-pull
selection: none
when: git
```
`selection` can be `auto`, `current`, `marked` or `none`.
Available generic `when` conditions include `always`, `git`, `not-git`, `file`, `folder`, `marked`, `multiple`, `exists:<path>`, `missing:<path>`, `glob:<pattern>`, plus `all`, `any` and `not` expressions.
Actions that operate on the current directory rather than a file can use:
```yaml
actions:
git-pull:
target: none
command: git pull
```
This keeps the Python code generic: menu presentation, labels, shortcuts, conditions and shell commands belong in `.tui`.