A home terminal app's console setup and its fzt command palette (from at-home-tools, AHT-258)
- Go 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
Suite release / module (push) Successful in 17s
Suite release / scope (push) Successful in 4s
Suite release / deploy-image (push) Has been skipped
Suite release / reserve (push) Has been skipped
Suite release / check-manifest (push) Has been skipped
Suite release / check-package (push) Has been skipped
Suite release / build (none, ubuntu-latest) (ubuntu-latest, none) (push) Has been skipped
Suite release / finalize (push) Has been skipped
Suite release / check-build (none, ubuntu-latest) (ubuntu-latest, none) (push) Has been skipped
Suite release / reused-checks (push) Has been skipped
Suite release / publish (push) Has been skipped
Suite release / deliver (push) Has been skipped
Suite release / deliver-prune (push) Has been skipped
|
||
| console_other.go | ||
| console_windows.go | ||
| console_windows_test.go | ||
| go.mod | ||
| go.sum | ||
| options.go | ||
| palette.go | ||
| README.md | ||
termconsole
The console the house's terminal programs draw in: virtual terminal mode, its width, keys and the command palette.
VT(f): whetherfis a console, turning on its escape sequences if so;Width(f)is its width in columns, 80 when it has none.Open(): the console for reading keys, leaving the mouse with the terminal so a drag selects text and tmux turns the wheel into arrow keys. An "any key" prompt hears every key a person would press: a key with no name of its own isOtherKey.Console.Palette(title, rows): the app's command palette, as a tmux popup over its pane drawn by the fzt-automate tmux keeps running (tmux display-picker, FZTA-25), so no program starts for it; returns the action picked, or""when it was closed.QuoteProgram(path): a program path quoted for a Windows command line.
Windows is the real implementation; elsewhere Open refuses and VT and Width answer plainly, so a program still builds there. It was
at-home-tools' termconsole package until shared packages got repositories of their own
(AGT-85,
AHT-258).
Using it
require forgejo.romaine.life/romaine-life/termconsole v0.1.0
import "forgejo.romaine.life/romaine-life/termconsole"
if termconsole.VT(os.Stdout) {
width := termconsole.Width(os.Stdout)
...
}
Testing
go test ./...; the console tests are Windows-only.
Shipping
A library: the release-module topic in
pipeline-templates' fleet.json
tags each merge that changes the code, and every fleet repository whose go.mod requires it
gets a take-up. Forgejo pushes it to its public GitHub copy, which proxy.golang.org serves to
builds outside CI.