add only-me. fix xterm commit

This commit is contained in:
Jeff Carr 2024-02-15 22:46:35 -06:00
parent 0b40e4fde2
commit 3887ab99d8
4 changed files with 27 additions and 33 deletions

View File

@ -2,7 +2,7 @@
all: build all: build
reset reset
./autotypist ./autotypist --only-me
stderr: build stderr: build
echo "writing to /tmp/autotypist.log" echo "writing to /tmp/autotypist.log"

View File

@ -17,6 +17,7 @@ var args struct {
GitPull bool `arg:"--git-pull" help:"do git pull in every repository"` GitPull bool `arg:"--git-pull" help:"do git pull in every repository"`
CheckoutUser bool `arg:"--switch-to-user-branch" help:"switch everything to your user branch"` CheckoutUser bool `arg:"--switch-to-user-branch" help:"switch everything to your user branch"`
CheckoutDevel bool `arg:"--switch-to-devel-branch" help:"switch everything to the devel branch"` CheckoutDevel bool `arg:"--switch-to-devel-branch" help:"switch everything to the devel branch"`
OnlyMe bool `arg:"--only-me" help:"only scan repos from ~/.config/autotypist"`
} }
func init() { func init() {

View File

@ -134,22 +134,22 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
newRepo.endBox.NewButton("show diff", func() { newRepo.endBox.NewButton("show diff", func() {
me.reposwin.Disable() me.reposwin.Disable()
newRepo.status.XtermNohup([]string{"git diff"}) // newRepo.status.XtermNohup([]string{"git diff"})
newRepo.status.Xterm("git diff; bash")
me.reposwin.Enable() me.reposwin.Enable()
}) })
newRepo.endBox.NewButton("commit all", func() { newRepo.endBox.NewButton("commit all", func() {
me.reposwin.Disable() me.reposwin.Disable()
// restore anything staged so everything can be reviewed // restore anything staged so everything can be reviewed
newRepo.status.Xterm([]string{"git restore --staged ."}) newRepo.status.RunCmd([]string{"git", "restore", "--staged", "."})
// newRepo.status.Xterm([]string{"git diff"}) newRepo.status.XtermWait("git diff")
newRepo.status.Xterm([]string{"git add --all"}) newRepo.status.XtermWait("git add --all")
newRepo.status.XtermNohup([]string{"git diff --cached"}) newRepo.status.XtermWait("git commit -a")
newRepo.status.Xterm([]string{"git commit -a"}) newRepo.status.XtermWait("git push")
newRepo.status.Xterm([]string{"git push"})
if newRepo.status.CheckDirty() { if newRepo.status.CheckDirty() {
// commit was not done, restore diff // commit was not done, restore diff
newRepo.status.Xterm([]string{"git restore --staged ."}) newRepo.status.RunCmd([]string{"git", "restore", "--staged", "."})
} else { } else {
newRepo.status.Update() newRepo.status.Update()
newRepo.newScan() newRepo.newScan()
@ -231,13 +231,18 @@ func repolistWindow() {
me.reposgrid.NextRow() me.reposgrid.NextRow()
} }
for i, path := range repostatus.ListGitDirectories() { if args.OnlyMe {
// log.Info("addRepo()", i, path) log.Info("not scanning everything")
tmp := strings.TrimPrefix(path, me.goSrcPwd.String()) } else {
path = strings.Trim(tmp, "/") log.Info("scanning everything in ~/go/src")
log.Info("addRepo()", i, path) for i, path := range repostatus.ListGitDirectories() {
addRepo(me.reposgrid, path, "master", "devel", usr.Username) // log.Info("addRepo()", i, path)
me.reposgrid.NextRow() tmp := strings.TrimPrefix(path, me.goSrcPwd.String())
path = strings.Trim(tmp, "/")
log.Info("addRepo()", i, path)
addRepo(me.reposgrid, path, "master", "devel", usr.Username)
me.reposgrid.NextRow()
}
} }
} }
@ -315,7 +320,7 @@ func repoAllButtons(box *gui.Node) {
log.Info("build worked", repo.String()) log.Info("build worked", repo.String())
} else { } else {
log.Info("build failed", repo.String()) log.Info("build failed", repo.String())
go repo.status.Xterm([]string{"bash"}) go repo.status.Xterm("bash")
return return
} }
} }

View File

@ -47,14 +47,7 @@ func makeTagWindow() *tagWindow {
me.autotypistWindow.Disable() me.autotypistWindow.Disable()
defer me.autotypistWindow.Enable() defer me.autotypistWindow.Enable()
for _, repo := range me.allrepos { for _, repo := range me.allrepos {
tagsW := repo.status.TagsW allTags := repo.status.Tags.ListAll()
if tagsW == nil {
repo.status.TagWindow()
tagsW = repo.status.TagsW
// tagsW.Prune()
continue
}
allTags := tagsW.ListAll()
for _, t := range allTags { for _, t := range allTags {
log.Info("found tag:", t.TagString(), "from", repo.status.String()) log.Info("found tag:", t.TagString(), "from", repo.status.String())
} }
@ -70,26 +63,21 @@ func makeTagWindow() *tagWindow {
} else { } else {
// continue // continue
} }
tagsW := repo.status.TagsW tagsW := repo.status.Tags
if tagsW == nil {
repo.status.TagWindow()
tagsW = repo.status.TagsW
continue
}
tagsW.PruneSmart() tagsW.PruneSmart()
deleteTags := tagsW.List() deleteTags := tagsW.List()
for _, t := range deleteTags { for _, t := range deleteTags {
tagW.grid.NewLabel(t.TagString()) tagW.grid.NewLabel(t.TagString())
tagW.grid.NewLabel(repo.status.String()) tagW.grid.NewLabel(repo.status.String())
tagW.grid.NewButton("delete", func() { tagW.grid.NewButton("delete", func() {
tagsW.Delete(t) repo.status.DeleteTag(t)
}) })
tagW.grid.NextRow() tagW.grid.NextRow()
if me.autoDryRun.Checked() { if me.autoDryRun.Checked() {
log.Info("delete tag --dry-run:", t.TagString(), "from", repo.status.String()) log.Info("delete tag --dry-run:", t.TagString(), "from", repo.status.String())
} else { } else {
log.Info("Deleting tag:", t.TagString(), "from", repo.status.String()) log.Info("Deleting tag:", t.TagString(), "from", repo.status.String())
go tagsW.Delete(t) go repo.status.DeleteTag(t)
log.Sleep(1) log.Sleep(1)
} }
} }