feat: align GUI and CLI with WebUI - move GUI to cmd/gui/, add REPL+mgmt to waiter, enhance GUI features

This commit is contained in:
root
2026-07-16 20:28:56 +08:00
parent 4184cd0849
commit 5c07ada077
9 changed files with 38 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import (
"strings"
"syscall"
"time"
"unsafe"
)
const (
@ -236,4 +237,34 @@ func printServerOutput(content string) {
}
}
func setRawMode(fd int) (func(), error) {
type termios struct {
Iflag uint32
Oflag uint32
Cflag uint32
Lflag uint32
Cc [20]byte
Ispeed uint32
Ospeed uint32
}
const (
TCGETS = 0x5401
TCSETS = 0x5402
ICANON = 0x2
ECHO = 0x8
)
var old termios
if _, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), TCGETS, uintptr(unsafe.Pointer(&old))); err != 0 {
return func() {}, fmt.Errorf("ioctl TCGETS: %v", err)
}
new := old
new.Lflag &^= ICANON | ECHO
if _, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), TCSETS, uintptr(unsafe.Pointer(&new))); err != 0 {
return func() {}, fmt.Errorf("ioctl TCSETS: %v", err)
}
return func() {
syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), TCSETS, uintptr(unsafe.Pointer(&old)))
}, nil
}