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
reset
./autotypist
./autotypist --only-me
stderr: build
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"`
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"`
OnlyMe bool `arg:"--only-me" help:"only scan repos from ~/.config/autotypist"`
}
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() {
me.reposwin.Disable()
newRepo.status.XtermNohup([]string{"git diff"})
// newRepo.status.XtermNohup([]string{"git diff"})
newRepo.status.Xterm("git diff; bash")
me.reposwin.Enable()
})
newRepo.endBox.NewButton("commit all", func() {
me.reposwin.Disable()
// restore anything staged so everything can be reviewed
newRepo.status.Xterm([]string{"git restore --staged ."})
// newRepo.status.Xterm([]string{"git diff"})
newRepo.status.Xterm([]string{"git add --all"})
newRepo.status.XtermNohup([]string{"git diff --cached"})
newRepo.status.Xterm([]string{"git commit -a"})
newRepo.status.Xterm([]string{"git push"})
newRepo.status.RunCmd([]string{"git", "restore", "--staged", "."})
newRepo.status.XtermWait("git diff")
newRepo.status.XtermWait("git add --all")
newRepo.status.XtermWait("git commit -a")
newRepo.status.XtermWait("git push")
if newRepo.status.CheckDirty() {
// commit was not done, restore diff
newRepo.status.Xterm([]string{"git restore --staged ."})
newRepo.status.RunCmd([]string{"git", "restore", "--staged", "."})
} else {
newRepo.status.Update()
newRepo.newScan()
@ -231,13 +231,18 @@ func repolistWindow() {
me.reposgrid.NextRow()
}
for i, path := range repostatus.ListGitDirectories() {
// log.Info("addRepo()", i, path)
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()
if args.OnlyMe {
log.Info("not scanning everything")
} else {
log.Info("scanning everything in ~/go/src")
for i, path := range repostatus.ListGitDirectories() {
// log.Info("addRepo()", i, path)
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())
} else {
log.Info("build failed", repo.String())
go repo.status.Xterm([]string{"bash"})
go repo.status.Xterm("bash")
return
}
}

View File

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