Add tailnew: follow the newest log file in a directory
tailnew tails the most recently started file in a directory and switches to each new one as it appears, for watching harnesses such as boxmaker's run-plan.sh that write one log per task. A file counts as new when its name is new, when the name points at a different file, or when it has shrunk (a rerun truncating its old log). Three front ends share one follower: plain tail -f style output, a ratatui terminal view with scrollback, and an egui window with a folder dialog and a Recursive checkbox. The Makefile provides build, gate and a per-user install that also installs a desktop entry for the window. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# tailnew
|
||||
|
||||
Follows the newest file in a directory, like `tail -f`, and switches to each new file as it
|
||||
appears. Built for watching harnesses such as boxmaker's `tools/run-plan.sh`, which write one log
|
||||
per task.
|
||||
|
||||
make install # ~/.local/bin/tailnew and a desktop entry for the window
|
||||
tailnew .state/runs/M2a # plain output, `==> file <==` banner on each switch
|
||||
tailnew -t -r .state/runs # full-screen terminal view, every milestone's directory
|
||||
tailnew --gui -r .state/runs # desktop window (egui)
|
||||
tailnew --gui # desktop window, asks for the folder first
|
||||
|
||||
`make gate` checks formatting, runs clippy with and without the window, runs the tests, and
|
||||
validates the desktop entry. `PREFIX=/usr/local make install` installs elsewhere;
|
||||
`cargo build --no-default-features` builds without the window.
|
||||
|
||||
A file is new when its name has not been seen before, when the name now points at a different
|
||||
file, or when it has shrunk (a rerun that truncated its old log with `>`). The directory is polled
|
||||
(`-i MS`, default 250) and need not exist yet. Hidden files are ignored; `-g '*.log'` narrows the
|
||||
match further.
|
||||
|
||||
Keys in the full-screen terminal view (`-t`):
|
||||
|
||||
| key | action |
|
||||
|-------------------------|----------------------------------------------------|
|
||||
| ↑ ↓ / k j | scroll a line |
|
||||
| PgUp PgDn / b space | scroll a page (ctrl-u / ctrl-d: half a page) |
|
||||
| g / G | top / back to following the tail |
|
||||
| [ ] | older / newer file (pins the view to it) |
|
||||
| p | pin to the current file; again to unpin and jump to the newest |
|
||||
| L | unpin and jump to the newest file |
|
||||
| w | toggle line wrapping |
|
||||
| f | toggle the file list |
|
||||
| q / esc | quit |
|
||||
|
||||
The window (`--gui`) has a **Folder…** button (the desktop's folder dialog, also `o`) and a
|
||||
**Recursive** checkbox, buttons for the same file controls, a clickable file list, and the keys
|
||||
`[` `]` `p` `L` `f`, `G`/End to jump to the end, and `q`/Esc to quit. Started without a folder,
|
||||
as from the launcher, it opens the folder dialog straight away. It scrolls with the mouse,
|
||||
sticks to the bottom while you are there, and does not wrap long lines (scroll sideways instead).
|
||||
Reference in New Issue
Block a user