Revert "Going from a REPL to a TUI"

This reverts commit 0162c14c1d.
This commit is contained in:
2026-01-05 10:32:57 +00:00
parent 0162c14c1d
commit 8d1e7c962f
9 changed files with 151 additions and 460 deletions
+4 -29
View File
@@ -11,7 +11,6 @@ import (
const (
newWindowCMDID types.Command = 3
destroyWindowCMDID types.Command = 4
moveWindowCMDID types.Command = 5
)
var (
@@ -69,13 +68,6 @@ var CDashDisplay = Device{
ArgCheck: destroyWindowArgCheck,
Fn: destroyWindow,
},
"move-window": {
Identifier: moveWindowCMDID,
Name: "move-window",
Desc: "Moves a selected window - pass the window ID",
ArgCheck: moveWindowArgCheck,
Fn: moveWindow,
},
},
}
@@ -91,6 +83,8 @@ func createWindowArgCheck(args []string) error {
func createWindow(dCMD *DeviceCMD, args []string) (types.Command, []byte, error) {
// Parse the command
// x0, y0, width, height, title # add other decorations later on
// fmt.Printf("%s command called: %+v\n", dCMD.GetName(), args)
x0, err := strconv.ParseInt(args[0], 10, 0)
if err != nil {
return 0, []byte{}, err
@@ -138,6 +132,8 @@ func destroyWindowArgCheck(args []string) error {
func destroyWindow(dCMD *DeviceCMD, args []string) (types.Command, []byte, error) {
// Parse the command
fmt.Printf("%s command called: %+v\n", dCMD.GetName(), args)
type UIWindowDestructPacket struct {
WinID int16
}
@@ -158,24 +154,3 @@ func destroyWindow(dCMD *DeviceCMD, args []string) (types.Command, []byte, error
return dCMD.GetIdentifier(), bytes, nil
}
func moveWindowArgCheck(args []string) error {
if len(args) != 1 {
return fmt.Errorf("wrong parameters, got %d, want %d. "+
"Command asks for: winID", len(args), 1)
}
return nil
}
func moveWindow(dCMD *DeviceCMD, args []string) (types.Command, []byte, error) {
// We can edit this struct to be a generic 'window edit' struct. Either
// that or implement a way of passing arbitrary fields to update
type UIWindowMovePacket struct {
WinID int16
Direction uint8
Quantity uint8
}
return dCMD.GetIdentifier(), []byte{}, nil
}
+1 -5
View File
@@ -1,10 +1,7 @@
// Package devices will define the available devices we can communicate with
package devices
import (
"esdi/peripheral/types"
"fmt"
)
import "esdi/peripheral/types"
// IDs for our devices. They need to be correctly mapped on the devices
// themselves so we can discover them
@@ -69,7 +66,6 @@ func (dCMD *DeviceCMD) Run(args []string) (types.Command, []byte, error) {
}
// Run the function
fmt.Printf("%s command called: %+v\n", dCMD.GetName(), args)
return dCMD.Fn(dCMD, args)
}