general usefulness

This commit is contained in:
Jeff Carr 2025-01-28 21:15:24 -06:00
parent bb7937bb79
commit eee88af0ce
7 changed files with 24 additions and 32 deletions

13
argv.go
View File

@ -100,13 +100,12 @@ type DirtyCmd struct {
} }
type FindCmd struct { type FindCmd struct {
Patches *EmptyCmd `arg:"subcommand:patches" help:"show repos that have patches"` All bool `arg:"--all" help:"select every repo (the default)"`
All bool `arg:"--all" help:"select every repo (the default)"` Mine bool `arg:"--mine" help:"your repos as defined in the forge config"`
Mine bool `arg:"--mine" help:"your repos as defined in the forge config"` Favorites bool `arg:"--favorites" help:"your repos configured as favorites"`
Favorites bool `arg:"--favorites" help:"your repos configured as favorites"` Private bool `arg:"--private" help:"your private repos from your .config/forge/"`
Private bool `arg:"--private" help:"your private repos from your .config/forge/"` Dirty bool `arg:"--dirty" help:"only use dirty git repos"`
Dirty bool `arg:"--dirty" help:"only use dirty git repos"` User bool `arg:"--user" help:"show repos on the user branch"`
User bool `arg:"--user" help:"show repos on the user branch"`
// ReadOnly bool `arg:"--readonly" help:"include read-only repos"` // ReadOnly bool `arg:"--readonly" help:"include read-only repos"`
} }

View File

@ -3,7 +3,6 @@ package main
import ( import (
"fmt" "fmt"
"os" "os"
"os/user"
) )
/* /*
@ -22,8 +21,7 @@ func (args) doBashAuto() {
argv.doBashHelp() argv.doBashHelp()
switch argv.BashAuto[0] { switch argv.BashAuto[0] {
case "checkout": case "checkout":
usr, _ := user.Current() fmt.Println("user devel master ")
fmt.Println("user devel master " + usr.Username)
case "clean": case "clean":
// me.pp.WriteHelp(os.Stderr) // me.pp.WriteHelp(os.Stderr)
// me.pp.WriteUsageForSubcommand(os.Stderr, me.pp.SubcommandNames()...) // me.pp.WriteUsageForSubcommand(os.Stderr, me.pp.SubcommandNames()...)
@ -41,7 +39,7 @@ func (args) doBashAuto() {
case "examine": case "examine":
fmt.Println("fix") fmt.Println("fix")
case "list": case "list":
fmt.Println("--all --mine --favorites --private patches") fmt.Println("--all --mine --favorites --private")
case "pull": case "pull":
fmt.Println("--verbose") fmt.Println("--verbose")
case "patch": case "patch":

View File

@ -14,7 +14,7 @@ func rillPull(repo *gitpb.Repo) error {
return nil return nil
} }
t, _ := repo.LastGitPull() t, _ := repo.LastGitPull()
if time.Since(t) < time.Hour { if time.Since(t) < time.Minute*10 {
if argv.Verbose { if argv.Verbose {
log.Info(repo.GetFullPath(), "git pulled too recently", shell.FormatDuration(time.Since(t))) log.Info(repo.GetFullPath(), "git pulled too recently", shell.FormatDuration(time.Since(t)))
} }

View File

@ -1,8 +1,6 @@
package main package main
import ( import (
"path/filepath"
"go.wit.com/lib/protobuf/gitpb" "go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log" "go.wit.com/log"
) )
@ -24,14 +22,13 @@ func doVerifyDevel() error {
continue continue
} }
// check if devel branch exists in remote repo
devel := repo.GetDevelBranchName() devel := repo.GetDevelBranchName()
if argv.Verbose { if argv.Verbose {
log.Printf("Start clean devel branch: %s %s\n", repo.GetGoPath(), devel) log.Printf("Start clean devel branch: %s %s\n", repo.GetGoPath(), devel)
} }
if repo.Exists(filepath.Join(".git/refs/remotes/origin", devel)) { // check if devel branch exists in remote repo
// todo: actually use .git/config if repo.IsBranchRemote(devel) {
if err := doCleanDevelRepo(repo); err != nil { if err := doCleanDevelRepo(repo); err != nil {
log.Info(repo.GetGoPath(), "verify clean failed") log.Info(repo.GetGoPath(), "verify clean failed")
} }
@ -40,11 +37,12 @@ func doVerifyDevel() error {
} }
// devel branch is only local // devel branch is only local
/* /*
devname := repo.GetDevelBranchName() todo: something?
if err := requiresGitPush(repo, devname); err != nil { devname := repo.GetDevelBranchName()
log.Info(repo.GetGoPath(), "is out of sync with upstream") if err := requiresGitPush(repo, devname); err != nil {
return err log.Info(repo.GetGoPath(), "is out of sync with upstream")
} return err
}
*/ */
} }
return nil return nil

View File

@ -17,11 +17,6 @@ func (f *FindCmd) findRepos() {
return return
} }
if argv.List.Patches != nil {
findReposWithPatches()
return
}
if f.All { if f.All {
findAll() findAll()
return return

View File

@ -159,6 +159,11 @@ func main() {
log.Info(i, line) log.Info(i, line)
} }
} }
if argv.Patch.Show != nil {
findReposWithPatches()
me.forge.PrintHumanTable(me.found)
}
okExit("patch list") okExit("patch list")
} }

View File

@ -1,10 +1,7 @@
# this file is automatically re-generated from forge.pb, however,
# if you want to edit it by hand, you can:
# stop forge; remove forge.pb; edit forge.text; start forge
# this will cause the default behavior to fallback to parsing this file for the config
# this file is intended to be used to customize settings on what # this file is intended to be used to customize settings on what
# git repos you have write access to. That is, where you can run 'git push' # git repos you have write access to. That is, where you can run 'git push'
#
# add entries to this using 'forge config'
ForgeConfigs: { ForgeConfigs: {
goPath: "go.wit.com" goPath: "go.wit.com"