Compare commits

...

2 Commits

Author SHA1 Message Date
Jeff Carr 29cb5564c2 tinkering
Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-02-29 17:36:45 -06:00
Jeff Carr e575b71f07 start droplet 2024-02-29 13:45:36 -06:00
4 changed files with 106 additions and 3 deletions

View File

@ -1,10 +1,16 @@
all: GUIVERSION = $(shell cd ~/go/src/go.wit.com/gui; git describe --tags)
all: build
vet:
@#GO111MODULE=off go build @#GO111MODULE=off go build
@GO111MODULE=off go vet -x @GO111MODULE=off go vet -x
@echo this go library package builds okay @echo this go library package builds okay
build: build:
@GO111MODULE=off go build -x -o junk @GO111MODULE=off go build -v -x -o junk \
-ldflags "-X main.GUIVERSION=${GUIVERSION}" \
-ldflags "-X go.wit.com/gui.GUIVERSION=${GUIVERSION}"
./junk ./junk
goimports: goimports:
@ -16,3 +22,7 @@ redomod:
GO111MODULE= go mod init GO111MODULE= go mod init
GO111MODULE= go mod tidy GO111MODULE= go mod tidy
actual: redomod
GO111MODULE= go build -x -o junk
./junk

View File

@ -48,7 +48,6 @@ func main() {
l := Less(c, s) l := Less(c, s)
fmt.Printf("%v is the smallest\n", l) fmt.Printf("%v is the smallest\n", l)
} }
func Less(s1, s2 Sizer) Sizer { func Less(s1, s2 Sizer) Sizer {

56
droplet.go Normal file
View File

@ -0,0 +1,56 @@
package main
import (
"fmt"
"io"
"go.wit.com/gui"
)
type Size interface {
Cpus() int
Memory() float64
Disk() float64
}
type SquareBox struct {
Width float64
Height float64
}
type MenuNode struct {
Name string
Box *gui.Node
}
func (s MenuNode) Area() float64 {
return 20
}
type Menu interface {
Widget() *gui.Node
SetMenu(*gui.Node)
}
type Draw interface {
Show() bool
Hide()
}
type Droplet interface {
Box() *DropletBox
Draw
SetMenu(*DropletBox)
Size
PowerOn() error
PowerOff() (bool, error)
Connect()
// Location
fmt.Stringer
io.Writer
}
func addMenu(d Droplet) {
d.Show()
// d.Menu.Widget() = gui.RawBox()
}

38
structs.go Normal file
View File

@ -0,0 +1,38 @@
/*
The DropletBox Struct
*/
package main
import (
"github.com/digitalocean/godo"
"go.wit.com/gui"
)
type DropletBox struct {
ID int
image string
memory int
disk int
ready bool
hidden bool
err error
poll *godo.Droplet // store what the digital ocean API returned
nameN *gui.Node
sizeSlugN *gui.Node
statusN *gui.Node
imageN *gui.Node
destroy *gui.Node
connect *gui.Node
poweron *gui.Node
poweroff *gui.Node
edit *gui.Node
ipv4 *gui.Node
ipv6 *gui.Node
}