attempt to rebuild autotypist

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-15 12:43:08 -06:00
parent 248c3f4cdb
commit 77c1b9258f
5 changed files with 59 additions and 12 deletions

View File

@ -1,12 +1,13 @@
all: all: build
myrepos
# ./myrepos >/tmp/myrepos.stderr 2>&1
build:
echo "build it!" echo "build it!"
-mkdir -p plugins/ -mkdir -p plugins/
-cp myrepolist plugins/ -cp myrepolist plugins/
-cp ~/go/src/go.wit.com/gui/toolkits/*.so plugins/ -cp ~/go/src/go.wit.com/gui/toolkits/*.so plugins/
go install -v -x go install -v -x
# go build -v -x
myrepos
# ./myrepos >/tmp/myrepos.stderr 2>&1
redomod: redomod:
rm -f go.* rm -f go.*

27
main.go
View File

@ -9,7 +9,7 @@ import (
"go.wit.com/gui/gui" "go.wit.com/gui/gui"
"go.wit.com/gui/gadgets" "go.wit.com/gui/gadgets"
"go.wit.com/gui/gadgets/repostatus" "go.wit.com/gui/tools/repostatus"
) )
//go:embed plugins/* //go:embed plugins/*
@ -93,7 +93,7 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
// This creates a window // This creates a window
func repoworld() { func repoworld() {
reposwin = gadgets.NewBasicWindow(myGui, "git autotypist. it types faster than you can.") reposwin = gadgets.NewBasicWindow(myGui, "autotypist for GO & git. it types faster than you can.")
reposwin.Make() reposwin.Make()
reposbox = reposwin.Box().NewBox("bw vbox", false) reposbox = reposwin.Box().NewBox("bw vbox", false)
@ -178,9 +178,17 @@ func repoworld() {
buildOptions.NewLabel("get autotypist") buildOptions.NewLabel("get autotypist")
buildOptions.NewButton("go get", func () { buildOptions.NewButton("go get", func () {
var newCmds [][]string var newCmds [][]string
newCmds = append(newCmds, []string{"mkdir", "-p", "go/src/go.wit.com/myrepos"}) newCmds = append(newCmds, []string{"mkdir", "-p", "go/src/go.wit.com/apps"})
newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/myrepos"}) newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/apps/myrepos"})
newCmds = append(newCmds, []string{"go", "git", "-v", "-u"}) newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "go.wit.com/apps/myrepos"})
newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/apps/myrepos"})
newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "."})
newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "go.wit.com/gui/toolkits"})
newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/gui/toolkits"})
newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "."})
newCmds = append(newCmds, []string{"go", "make"})
newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/apps/myrepos"})
newCmds = append(newCmds, []string{"go", "make"})
script = newCmds script = newCmds
setGitCommands() setGitCommands()
doit.Enable() doit.Enable()
@ -200,6 +208,15 @@ func repoworld() {
buildOptions.NewLabel("cmd") buildOptions.NewLabel("cmd")
cmds = buildOptions.NewLabel("ls") cmds = buildOptions.NewLabel("ls")
buildOptions.NewLabel("--dry-run")
dryrun = buildOptions.NewButton("show commands", func () {
if dryRunCommands() {
log.Warn("EVERYTHING MIGHT HAVE WORKED")
} else {
log.Warn("EVERYTHING DID NOT WORK")
}
})
buildOptions.NewLabel("Doit") buildOptions.NewLabel("Doit")
doit = buildOptions.NewButton("run commands", func () { doit = buildOptions.NewButton("run commands", func () {
doit.Disable() doit.Disable()

View File

@ -4,7 +4,7 @@ package main
import ( import (
"go.wit.com/log" "go.wit.com/log"
"go.wit.com/gui/gadgets/repostatus" "go.wit.com/gui/tools/repostatus"
) )
func (r *repo) newScan() bool { func (r *repo) newScan() bool {

View File

@ -4,7 +4,7 @@ package main
import ( import (
"go.wit.com/gui/gui" "go.wit.com/gui/gui"
"go.wit.com/gui/gadgets" "go.wit.com/gui/gadgets"
"go.wit.com/gui/gadgets/repostatus" "go.wit.com/gui/tools/repostatus"
) )
// the main window nodes // the main window nodes
@ -16,6 +16,7 @@ var reposgroup *gui.Node
var cmds *gui.Node var cmds *gui.Node
var script [][]string var script [][]string
var doit *gui.Node var doit *gui.Node
var dryrun *gui.Node
var allrepos []*repo var allrepos []*repo

30
unix.go
View File

@ -4,11 +4,39 @@ import (
"strings" "strings"
"go.wit.com/log" "go.wit.com/log"
"go.wit.com/gui/gadgets/repostatus" "go.wit.com/gui/tools/repostatus"
) )
var repopath string = "/home/jcarr/" var repopath string = "/home/jcarr/"
func dryRunCommands() bool {
var workingPath string = "go/src"
for _, line := range script {
if len(line) == 0 {
continue
}
if line[0] == "cd" {
switch len(line) {
case 1:
log.Verbose("do cmdPwd() to go root", repopath + "go/src")
workingPath = ""
case 2:
log.Verbose("do cmdPwd() here", line)
workingPath = line[1]
default:
log.Warn("bad cd", line)
return false
}
continue
}
cmd := line[0]
s := strings.Join(line[1:], " ")
path := repopath + workingPath
log.Warn("NEED TO RUN path =", path, "cmd =", cmd, "argv:", s)
}
return true
}
func runCommands() bool { func runCommands() bool {
for _, line := range script { for _, line := range script {
s := strings.Join(line, " ") s := strings.Join(line, " ")