add 'forge find patches'

This commit is contained in:
Jeff Carr 2025-01-28 13:58:41 -06:00
parent 91c28de514
commit dd7355571d
3 changed files with 27 additions and 7 deletions

13
argv.go
View File

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

View File

@ -36,7 +36,7 @@ func (args) doBashAuto() {
case "examine":
fmt.Println("fix")
case "list":
fmt.Println("--all --mine --favorites --private")
fmt.Println("--all --mine --favorites --private patches")
case "pull":
fmt.Println("--all --mine --favorites --private")
case "patch":

19
find.go
View File

@ -17,6 +17,11 @@ func (f *FindCmd) findRepos() {
return
}
if argv.List.Patches != nil {
findReposWithPatches()
return
}
if f.All {
findAll()
return
@ -113,3 +118,17 @@ func findUser() {
}
}
}
func findReposWithPatches() {
all := me.forge.Repos.SortByFullPath()
for all.Scan() {
repo := all.Next()
if repo.IsDirty() {
me.found.AppendByGoPath(repo)
continue
}
if repo.GetUserVersion() != repo.GetDevelVersion() {
me.found.AppendByGoPath(repo)
}
}
}