summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-24 02:07:58 -0600
committerJeff Carr <[email protected]>2024-12-24 02:07:58 -0600
commit2b087365f68cb57a7dbebc29ac4f18bece9b554a (patch)
tree04a34298254b2eae53e5f6039bc38031da5b9fc7
parentbd332301bea8c53d9ee1fe8da79da3c19176fbf2 (diff)
move things into 'find' and 'do' subcommands
-rw-r--r--argv.go36
-rw-r--r--doCommon.go3
-rw-r--r--main.go42
3 files changed, 40 insertions, 41 deletions
diff --git a/argv.go b/argv.go
index 091402b..c47fd45 100644
--- a/argv.go
+++ b/argv.go
@@ -15,15 +15,15 @@ type FindCmd struct {
}
type DoCmd struct {
- List bool `arg:"--list" help:"just show a table of the current state"`
- Clone bool `arg:"--clone" help:"git clone build dependancies"`
- Scan bool `arg:"--scan" help:"reload protobuf from .git/"`
- Force bool `arg:"--force" help:"force redo things"`
- GitPull bool `arg:"--git-pull" help:"run 'git pull'"`
- GitReset bool `arg:"--git-reset" help:"run 'git reset --hard'"`
- Build bool `arg:"--build" default:"true" help:"try to build it"`
- Install bool `arg:"--install" help:"also try to install it"`
- // DoRedoGoMod bool `arg:"--RedoGoMod" help:"remake all the go.sum and go.mod files"`
+ List bool `arg:"--list" help:"just show a table of the current state"`
+ Clone bool `arg:"--clone" help:"git clone build dependancies"`
+ Scan bool `arg:"--scan" help:"reload protobuf from .git/"`
+ Force bool `arg:"--force" help:"force redo things"`
+ GitPull bool `arg:"--git-pull" help:"run 'git pull'"`
+ GitReset bool `arg:"--git-reset" help:"run 'git reset --hard'"`
+ Build bool `arg:"--build" default:"true" help:"try to build it"`
+ Install bool `arg:"--install" help:"also try to install it"`
+ RedoGoMod bool `arg:"--RedoGoMod" help:"remake all the go.sum and go.mod files"`
}
/*
@@ -48,15 +48,15 @@ type args struct {
// FindMine bool `arg:"--find-mine" help:"download private and writeable repos"`
// FindFavorites bool `arg:"--find-favorites" help:"download repos marked as favorites"`
// FindPrivate bool `arg:"--find-private" help:"list private repos in .config/forge/"`
- DoList bool `arg:"--do-list" help:"list found repos"`
- DoScan bool `arg:"--do-scan" help:"rescan your repos"`
- DoClone bool `arg:"--do-clone" help:"go-clone things you are missing"`
- DoForce bool `arg:"--do-force" help:"force redo go-clone"`
- DoGitPull bool `arg:"--do-git-pull" help:"run 'git pull' on all your repos"`
- DoGitReset bool `arg:"--do-git-reset" help:"run 'git reset --hard' on all read-only repos"`
- DoBuild bool `arg:"--do-build" default:"true" help:"also try to build it"`
- DoInstall bool `arg:"--do-install" help:"try to install every binary package"`
- DoRedoGoMod bool `arg:"--do-RedoGoMod" help:"remake all the go.sum and go.mod files"`
+ // DoList bool `arg:"--do-list" help:"list found repos"`
+ // DoScan bool `arg:"--do-scan" help:"rescan your repos"`
+ // DoClone bool `arg:"--do-clone" help:"go-clone things you are missing"`
+ DoForce bool `arg:"--do-force" help:"force redo go-clone"`
+ // DoGitPull bool `arg:"--do-git-pull" help:"run 'git pull' on all your repos"`
+ // DoGitReset bool `arg:"--do-git-reset" help:"run 'git reset --hard' on all read-only repos"`
+ // DoBuild bool `arg:"--do-build" default:"true" help:"also try to build it"`
+ // DoInstall bool `arg:"--do-install" help:"try to install every binary package"`
+ // DoRedoGoMod bool `arg:"--do-RedoGoMod" help:"remake all the go.sum and go.mod files"`
DoGui bool `arg:"--do-gui" help:"run the gui"`
DoPatchSet bool `arg:"--do-patches" help:"make patch set"`
ListPatchSet bool `arg:"--list-patches" help:"make patch set"`
diff --git a/doCommon.go b/doCommon.go
index 817bcfd..ef58738 100644
--- a/doCommon.go
+++ b/doCommon.go
@@ -34,9 +34,6 @@ func doGitPull() {
}
func doGitReset() {
- if !argv.DoGitReset {
- return
- }
all := me.found.SortByFullPath()
for all.Scan() {
repo := all.Next()
diff --git a/main.go b/main.go
index 5afa2d7..a732e14 100644
--- a/main.go
+++ b/main.go
@@ -119,30 +119,32 @@ func main() {
// now, do something to all of them (or just print out a table of them)
var done bool = false
- if argv.DoScan {
- doScan()
- done = true
- }
+ if argv.Do != nil {
+ if argv.Do.Scan {
+ doScan()
+ done = true
+ }
- if argv.DoRedoGoMod {
- doRedoGoMod()
- done = true
- }
+ if argv.Do.RedoGoMod {
+ doRedoGoMod()
+ done = true
+ }
- if argv.DoGitPull {
- doGitPull()
- done = true
- }
+ if argv.Do.GitPull {
+ doGitPull()
+ done = true
+ }
- if argv.DoGitReset {
- doGitReset()
- done = true
- }
+ if argv.Do.GitReset {
+ doGitReset()
+ done = true
+ }
- if argv.DoList {
- // print out the repos
- doCobol()
- done = true
+ if argv.Do.List {
+ // print out the repos
+ doCobol()
+ done = true
+ }
}
if argv.DoPatchSet {