9e0a98ed07
Validate(root): optional startup/test check for tree authoring faults — >1 slot child per node, empty word, duplicate sibling words, dead-end node — traversing circular slots without looping (#3). keypress subpackage: WaitForKey(ctx, cancel) cancels a context on any keystroke for watch-style streaming commands, with per-GOOS cbreak (linux TCGETS/TCSETS, BSD TIOCGETA/TIOCSETA) and a non-tty/unsupported fallback that just waits on ctx. Lifts the last OpenBSD-specific bit out of evpnc/maglevc's watch.go (#6). docs: replace PROPOSAL.md with an RFC-2119 design.md (FR/NFR for the library). Example now dogfoods Validate (a unit test) and keypress (a bounded `watch` command). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
20 lines
675 B
Go
20 lines
675 B
Go
// SPDX-FileCopyrightText: (C) Copyright 2026 Pim van Pelt <pim@ipng.ch>
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
//go:build !linux && !openbsd && !freebsd && !netbsd && !dragonfly && !darwin
|
|
|
|
package keypress
|
|
|
|
import "errors"
|
|
|
|
// termiosState is a placeholder so cbreak/restore have a consistent signature on
|
|
// platforms without a supported termios path. On those platforms cbreak always
|
|
// fails, so WaitForKey degrades to waiting on the context (it never reads stdin).
|
|
type termiosState struct{}
|
|
|
|
func cbreak(int) (*termiosState, error) {
|
|
return nil, errors.New("keypress: cbreak is unsupported on this platform")
|
|
}
|
|
|
|
func restore(int, *termiosState) error { return nil }
|