mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-09-23 10:28:06 +00:00
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:
9
Makefile
9
Makefile
@ -1,13 +1,14 @@
|
||||
.PHONY: all build build-cli clean install test run build-static build-linux-arm64 lint fmt
|
||||
.PHONY: all build build-cli build-gui clean install test run build-static build-linux-arm64 lint fmt
|
||||
|
||||
BINARY=homed
|
||||
CLI_BINARY=waiter
|
||||
GUI_BINARY=homeagent-gui
|
||||
GO=go
|
||||
GOCACHE=/tmp/gocache
|
||||
export GOPATH=/tmp/gopath
|
||||
BUILD_DIR=build
|
||||
PROJECT_ROOT := $(CURDIR)
|
||||
VERSION ?= $(shell git describe --tags --dirty 2>/dev/null || echo "0.6.2")
|
||||
VERSION ?= $(shell git describe --tags --dirty 2>/dev/null || echo "0.7.1")
|
||||
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
||||
BUILD_TIME ?= $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
|
||||
LDFLAGS = -X gitcode.com/JianFeeeee/HomeAgent/internal/meta.Version=$(VERSION) -X gitcode.com/JianFeeeee/HomeAgent/internal/meta.Commit=$(COMMIT) -X gitcode.com/JianFeeeee/HomeAgent/internal/meta.BuildTime=$(BUILD_TIME)
|
||||
@ -24,6 +25,10 @@ build-cli:
|
||||
CGO_ENABLED=0 $(GO) build -installsuffix dynlink -o $(BUILD_DIR)/$(CLI_BINARY) ./cmd/waiter/
|
||||
@echo "Built: $(BUILD_DIR)/$(CLI_BINARY)"
|
||||
|
||||
build-gui:
|
||||
@cd cmd/gui && npm install --production && npx electron-packager . $(GUI_BINARY) --out=../../$(BUILD_DIR) --overwrite --no-sandbox
|
||||
@echo "Built: $(BUILD_DIR)/$(GUI_BINARY)"
|
||||
|
||||
build-static:
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
CGO_ENABLED=1 $(GO) build -tags netgo -installsuffix dynlink -ldflags '-extldflags "-static" $(LDFLAGS)' -o $(BUILD_DIR)/$(BINARY)-static ./cmd/homed/
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user