From dd7355571d80b4d6c970e417df85244dbfd253e0 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 28 Jan 2025 13:58:41 -0600 Subject: [PATCH] add 'forge find patches' --- argv.go | 13 +++++++------ argvAutoshell.go | 2 +- find.go | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/argv.go b/argv.go index 13bedd9..5d71db3 100644 --- a/argv.go +++ b/argv.go @@ -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"` } diff --git a/argvAutoshell.go b/argvAutoshell.go index 96c5e14..725efdb 100644 --- a/argvAutoshell.go +++ b/argvAutoshell.go @@ -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": diff --git a/find.go b/find.go index 2c21e85..c230330 100644 --- a/find.go +++ b/find.go @@ -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) + } + } +}