// 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) } }