A controlled reader renders accepted application frames in a new virtual-only cthulhu-braille mode at the controller's width and applies its pan and route gestures; reader UI, flashes and secure frames are never exported, and hidden frames are unroutable. A controller reader reports its display width, shows peer cells as an untranslated raw frame and forwards local pan and routing keys. The physical helper now reports its width and edge pans. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
// cthulhu-braille is the isolated BrlAPI helper and standalone diagnostic.
|
|
// The main executable starts it only when braille is enabled.
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
"git.stormux.org/storm/cthulhu/internal/braille"
|
|
)
|
|
|
|
func main() {
|
|
if len(os.Args) > 2 || len(os.Args) == 2 && os.Args[1] != "--client" && os.Args[1] != "--virtual" {
|
|
fmt.Fprintln(os.Stderr, "Usage: cthulhu-braille [--client|--virtual]")
|
|
os.Exit(2)
|
|
}
|
|
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
|
defer cancel()
|
|
if len(os.Args) == 2 && os.Args[1] == "--virtual" {
|
|
// Remote export: no display is opened; the parent owns the session.
|
|
if err := braille.RunVirtual(ctx, os.Stdin, os.Stdout); err != nil {
|
|
fmt.Fprintf(os.Stderr, "cthulhu-braille: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
return
|
|
}
|
|
if len(os.Args) == 2 {
|
|
if err := braille.RunClient(ctx, braille.NewRouting(), os.Stdin, os.Stdout); err != nil {
|
|
fmt.Fprintf(os.Stderr, "cthulhu-braille: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
return
|
|
}
|
|
if err := braille.Diagnostic(ctx, braille.New(), os.Stdout); err != nil {
|
|
fmt.Fprintf(os.Stderr, "cthulhu-braille: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|