Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-18 14:46:20 -06:00
parent 209074a244
commit cbafaa3c66
6 changed files with 21 additions and 23 deletions

View File

@ -3,10 +3,11 @@ all: build
stderr: build
echo "writing to /tmp/autotypist.stderr"
autotypist >/tmp/autotypist.stderr 2>&1
./autotypist >/tmp/autotypist.stderr 2>&1
build:
echo "build it!"
goimports -w *.go
-rm resources/*.so
go build -v -x

View File

@ -9,6 +9,7 @@ import (
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/repostatus"
)
func doesExist(path string) bool {
@ -27,12 +28,11 @@ func quickCmd(fullpath string, cmd []string) bool {
var output string
log.Warn("RUN:", fullpath, cmd)
cmd = []string{"mkdir", "-p", "go.wit.com/apps/"}
err, b, output = repostatus.RunCmd(fullpath, cmd)
if err != nil {
err, b, output = RunCmdNew(fullpath, cmd)
log.Error(err)
return false
} else if ! b {
} else if !b {
log.Warn("b =", b)
log.Warn("output =", string(output))
return true
@ -100,13 +100,14 @@ func globalBuildOptions(box *gui.Node) {
quickCmd(fullpath, []string{"pwd"})
quickCmd(fullpath, []string{"ls", "-l"})
quickCmd(fullpath, []string{"go", "status"}) // TODO: process this?
quickCmd(fullpath, []string{"git", "status"}) // TODO: process this?
quickCmd(fullpath, []string{"rm", "go.mod", "go.sum"})
quickCmd(fullpath, []string{"go", "mod", "init"})
log.Sleep(.1) // don't hammer google's golang versioning system
quickCmd(fullpath, []string{"go", "mod", "tidy"})
log.Sleep(.2) // don't hammer google's golang versioning system
log.Sleep(.2) // don't hammer google's golang versioning system
quickCmd(fullpath, []string{"git", "status"}) // TODO: process this?
}
// re-enable the button
me.rerunGoMod.SetText("re-run go mod & go tidy")

6
go.mod
View File

@ -1,11 +1,11 @@
module go.wit.com/apps/myrepos
module go.wit.com/apps/autotypist
go 1.21.4
require (
go.wit.com/gui v0.12.16
go.wit.com/lib/gadgets v0.12.8
go.wit.com/lib/gui/repostatus v0.12.10
go.wit.com/lib/gadgets v0.12.9
go.wit.com/lib/gui/repostatus v0.12.12
go.wit.com/log v0.5.5
)

8
go.sum
View File

@ -6,10 +6,10 @@ go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNe
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
go.wit.com/gui v0.12.16 h1:GBiPiDyzkGCxwNegehHiONmNppaqyFZv7iteLUHJ/Po=
go.wit.com/gui v0.12.16/go.mod h1:27+THr2a84GZ61KKUuN30WYnYoSsBewllUKc+fnWLto=
go.wit.com/lib/gadgets v0.12.8 h1:Y5YSOdoB3dD70j/cXrQPQay4P13TYMn2IIU8BZ8DHHg=
go.wit.com/lib/gadgets v0.12.8/go.mod h1:jDAyYalsa8cHElAl83T34qm5n8yEy+JaWSlFQoX8d7c=
go.wit.com/lib/gui/repostatus v0.12.10 h1:DI2kv1JnycU66MGc+jbt+KQFyuYxjl/zaaKUuMTO50Q=
go.wit.com/lib/gui/repostatus v0.12.10/go.mod h1:SIN3wljl0SkmZS7prenk5MZMx+GBsY3Gwa37eiIaK3Y=
go.wit.com/lib/gadgets v0.12.9 h1:yayXQDiAENfMElRMeh7Yab1f6HNkiy5Aw6KNP5Wd1DI=
go.wit.com/lib/gadgets v0.12.9/go.mod h1:Hb/vSiW22hPJjTVA1mShQ6HuqQ7dHGB95WLEfZlPO3M=
go.wit.com/lib/gui/repostatus v0.12.12 h1:l4mCK/M/QAOuFu+q6F/qVxKtt/+gxLPqTSMdJby+jAY=
go.wit.com/lib/gui/repostatus v0.12.12/go.mod h1:GqLGG3lxcnKQhmVwqE+G5uQoRwN+KdErPCWOHGABrEw=
go.wit.com/log v0.5.5 h1:bK3b94uVKgev4jB5wg06FnvCFBEapQICTSH2YW+CWr4=
go.wit.com/log v0.5.5/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
go.wit.com/widget v1.1.5 h1:jx5hJ2WLZJnCcvMuaLHegzpNlzwo+0kOkzsRkzRiB30=

View File

@ -21,7 +21,7 @@ func main() {
me.myGui = gui.New()
me.myGui.InitEmbed(resToolkit)
me.myGui.LoadToolkit("nocui")
// me.myGui.LoadToolkit("nocui")
me.myGui.Default()
autotypistWindow()

14
unix.go
View File

@ -1,14 +1,12 @@
package main
import (
"os"
"os/exec"
"time"
"strings"
"errors"
"os/exec"
"strings"
"go.wit.com/log"
"go.wit.com/lib/gui/repostatus"
"go.wit.com/log"
)
var repopath string = "/home/jcarr/"
@ -93,11 +91,12 @@ func runCommandsOld() bool {
*/
func RunCmdNew(workingpath string, parts []string) (error, bool, string) {
time.Sleep(10 * time.Second)
log.Warn("RUN NEW:", workingpath, parts)
return RunCmd(workingpath, parts)
}
func RunCmd(workingpath string, parts []string) (error, bool, string) {
log.Warn("RUN CMD:", workingpath, parts)
if len(parts) == 0 {
log.Warn("command line was empty")
return errors.New("empty"), false, ""
@ -110,9 +109,6 @@ func RunCmd(workingpath string, parts []string) (error, bool, string) {
parts = parts[1:]
log.Warn("working path =", workingpath, "thing =", thing, "cmdline =", parts)
if thing == "pwd" {
os.Exit(-1)
}
// Create the command
cmd := exec.Command(thing, parts...)