This commit is contained in:
Joakim
2026-10-12 23:30:17 +02:00
parent 212b922629
commit e1836a38e1
5 changed files with 88 additions and 133 deletions

View File

@@ -94,7 +94,8 @@ keys:
actions:
list-zip:
command:
command: 'unzip -l <path> && read -rp "Enter to continue.." || read -rp "FAILED - Enter to continue..."'
- unzip -l <path>
- read -rp "Tryck Enter för att fortsätta..."
move:
command: mv -v <path> <dir>
@@ -164,42 +165,44 @@ not clear the already marked paths.
When an action is triggered, TUI writes the generated commands to a temporary
file and exits with a private handoff status. The `tui()` Bash function then
executes them in the parent Bash process.
executes them.
When TUI is closed with `Ctrl+C`, the wrapper changes the parent Bash shell to
the directory where TUI was actually closed.
Action commands are handed to Bash as complete commands, so normal shell
operators such as `&&` and `||` work exactly as they do at the terminal. For
example:
For example:
```yaml
actions:
list-zip:
command: 'unzip -l <path> && read -rp "Enter to continue.." || read -rp "FAILED - Enter to continue..."'
```
The complete command is evaluated once. If `unzip` succeeds, the success
`read` is executed. If `unzip` fails, the failure `read` is executed.
For actions containing several separate commands, use a YAML list:
```yaml
actions:
example:
command:
- command-one <path>
- command-two <path>
- unzip -l <path>
- read -rp "Tryck Enter för att fortsätta..."
```
TUI is **not redrawn between commands belonging to the same action**. Each
command is inserted into Bash history. If a separate command fails, the
remaining commands in that action are not executed; TUI prints the exit code
and waits before returning to TUI.
The flow is:
The shell wrapper uses `pushd`/`popd` so action commands run in the directory
shown by TUI without permanently changing the user's Bash directory during
the action.
```text
TUI
↓
unzip -l archive.zip
↓
read -rp "Tryck Enter..."
↓
TUI
```
TUI is **not redrawn between commands belonging to the same action**.
Every command is also inserted into Bash history. If one command fails, the
remaining commands in that action are not executed. TUI prints the exit code
and waits for:
```text
Tryck Enter för att fortsätta...
```
before returning to TUI, so an error cannot disappear immediately.
The shell wrapper uses `pushd`/`popd` so the command runs in the directory
shown by TUI without permanently changing the user's Bash working directory.
## Security note
@@ -225,8 +228,7 @@ tui
The example configuration is in `tui/example.tui`.
### Cursor and block selection
### Version
There is an empty cursor position immediately below the last object in a directory. This makes range selection behave like a text editor.
Use `tui -v` or `tui --version` to verify the installed TUI version.
`Ctrl+K K` follows joe-style semantics: the end of the selection is the row immediately above the cursor. Thus, when the cursor is on the empty line below the final object, `Ctrl+K K` includes the final object.