command line option to rebuild

This commit is contained in:
Jeff Carr 2025-02-22 09:42:49 -06:00
parent ec11efc347
commit 1d4817f6af
3 changed files with 83 additions and 88 deletions

View File

@ -26,13 +26,14 @@ type args struct {
GitPull *FindCmd `arg:"subcommand:pull" help:"run 'git pull'"` GitPull *FindCmd `arg:"subcommand:pull" help:"run 'git pull'"`
URL string `arg:"--connect" help:"forge url"` URL string `arg:"--connect" help:"forge url"`
All bool `arg:"--all" help:"git commit --all"` All bool `arg:"--all" help:"git commit --all"`
Show string `arg:"--show" help:"show a repo"`
Build string `arg:"--build" help:"build a repo"` Build string `arg:"--build" help:"build a repo"`
Install string `arg:"--install" help:"install a repo"` Install string `arg:"--install" help:"install a repo"`
BuildForge bool `arg:"--forge-rebuild" help:"download and rebuild forge"`
Force bool `arg:"--force" help:"try to strong arm things"` Force bool `arg:"--force" help:"try to strong arm things"`
Verbose bool `arg:"--verbose" help:"show more output"` Verbose bool `arg:"--verbose" help:"show more output"`
Bash bool `arg:"--bash" help:"generate bash completion"` Bash bool `arg:"--bash" help:"generate bash completion"`
BashAuto []string `arg:"--auto-complete" help:"todo: move this to go-arg"` BashAuto []string `arg:"--auto-complete" help:"todo: move this to go-arg"`
// Show string `arg:"--show" help:"show a repo"`
} }
type EmptyCmd struct { type EmptyCmd struct {

22
main.go
View File

@ -79,6 +79,11 @@ func main() {
okExit("") okExit("")
} }
if argv.BuildForge {
buildForge()
okExit("")
}
if argv.Checkout != nil { if argv.Checkout != nil {
if err := doCheckout(); err != nil { if err := doCheckout(); err != nil {
badExit(err) badExit(err)
@ -124,23 +129,6 @@ func main() {
okExit("") okExit("")
} }
if argv.Show != "" {
repo := me.forge.FindByGoPath(argv.Show)
me.forge.HumanPrintRepo(repo)
// newt := repo.Times.LastUpdate.AsTime()
// oldt := repo.Times.MtimeHead.AsTime()
if repo.Times.LastUpdate == nil {
log.Info("SHOULD RUN Reload() here")
repo.Reload()
me.forge.HumanPrintRepo(repo)
} else {
if repo.Times.LastUpdate.Seconds < repo.Times.MtimeHead.Seconds {
log.Info("SHOULD RUN Reload() here")
}
}
okExit("")
}
if argv.GitFetch != nil { if argv.GitFetch != nil {
doGitFetch() doGitFetch()
okExit("") okExit("")

View File

@ -6,6 +6,8 @@ package main
// An app to submit patches for the 30 GO GUI repos // An app to submit patches for the 30 GO GUI repos
import ( import (
"os"
"go.wit.com/lib/fhelp" "go.wit.com/lib/fhelp"
"go.wit.com/lib/gui/shell" "go.wit.com/lib/gui/shell"
"go.wit.com/log" "go.wit.com/log"
@ -43,6 +45,12 @@ func makeHowtoWin() *genericWindow {
grid.NewButton("Download", func() { grid.NewButton("Download", func() {
howtoWin.Disable() howtoWin.Disable()
defer howtoWin.Enable() defer howtoWin.Enable()
buildForge()
})
return howtoWin
}
func buildForge() {
log.Info("download here") log.Info("download here")
if path, err := fhelp.CheckCmd("go-clone"); err != nil { if path, err := fhelp.CheckCmd("go-clone"); err != nil {
log.Info("go-clone missing", path, err) log.Info("go-clone missing", path, err)
@ -64,10 +72,9 @@ func makeHowtoWin() *genericWindow {
var basecmd []string var basecmd []string
var cmd []string var cmd []string
if me.forge.IsGoWork() { if me.forge.IsGoWork() {
log.Info("NOT GO WORK") log.Info("Using go.work directory")
basecmd = []string{"go-clone", "--work", "--recursive"} basecmd = []string{"go-clone", "--work", "--recursive"}
} else { } else {
log.Info("IS GO WORK")
basecmd = []string{"go-clone", "--recursive"} basecmd = []string{"go-clone", "--recursive"}
} }
// log.Info("Running:", cmd) // log.Info("Running:", cmd)
@ -76,6 +83,7 @@ func makeHowtoWin() *genericWindow {
cmd = append(basecmd, "go.wit.com/apps/go-mod-clean") cmd = append(basecmd, "go.wit.com/apps/go-mod-clean")
log.Info("Running:", cmd) log.Info("Running:", cmd)
shell.RunRealtime(cmd) shell.RunRealtime(cmd)
os.Exit(-1)
cmd = append(basecmd, "go.wit.com/apps/forge") cmd = append(basecmd, "go.wit.com/apps/forge")
log.Info("Running:", cmd) log.Info("Running:", cmd)
@ -96,6 +104,4 @@ func makeHowtoWin() *genericWindow {
repo.RunVerbose([]string{"autogenpb"}) repo.RunVerbose([]string{"autogenpb"})
} }
*/ */
})
return howtoWin
} }