summaryrefslogtreecommitdiff
path: root/argv.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-24 01:54:33 -0600
committerJeff Carr <[email protected]>2024-12-24 01:54:33 -0600
commitbd332301bea8c53d9ee1fe8da79da3c19176fbf2 (patch)
tree2aff858da422cdc04885f4c7fd14a28319d4c84f /argv.go
parentc5fcb2a6c05293cd6e14b3bd1e91237013508d44 (diff)
use subcommands
Diffstat (limited to 'argv.go')
-rw-r--r--argv.go87
1 files changed, 61 insertions, 26 deletions
diff --git a/argv.go b/argv.go
index d4f8fa6..091402b 100644
--- a/argv.go
+++ b/argv.go
@@ -6,33 +6,68 @@ package main
var argv args
+type FindCmd struct {
+ All bool `arg:"--all" help:"select every repo"`
+ ReadOnly bool `arg:"--readonly" help:"include read-only repos"`
+ 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:"private repos from your .config/forge/"`
+}
+
+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"`
+}
+
+/*
+arg.MustParse(&args)
+
+switch {
+case args.Checkout != nil:
+ fmt.Printf("checkout requested for branch %s\n", args.Checkout.Branch)
+case args.Commit != nil:
+ fmt.Printf("commit requested with message \"%s\"\n", args.Commit.Message)
+case args.Push != nil:
+ fmt.Printf("push requested from %s to %s\n", args.Push.Branch, args.Push.Remote)
+}
+*/
+
type args struct {
- Config bool `arg:"--config" help:"work from your .config/forge/ configuration"`
- FindAll bool `arg:"--find-all" help:"select every repo"`
- FindReadOnly bool `arg:"--find-readonly" help:"include read-only repos"`
- 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"`
- DoPatchSet bool `arg:"--do-patches" help:"make patch set"`
- ListPatchSet bool `arg:"--list-patches" help:"make patch set"`
- DoGui bool `arg:"--do-gui" help:"test the gui"`
- DryRun bool `arg:"--dry-run" help:"show what would be run"`
- Fix bool `arg:"--fix" help:"fix config, save config & exit"`
- URL string `arg:"--url" default:"http://go.wit.com/" help:"base url"`
- Delete string `arg:"--delete" help:"delete this repo"`
- Dirty bool `arg:"--dirty" help:"git CheckDirty() on every repo"`
- User bool `arg:"--user" help:"git checkout user"`
- Master bool `arg:"--master" help:"git checkout master"`
- Map []string `arg:"--map" help:"map a new repo"`
+ Find *FindCmd `arg:"subcommand:find" help:"select repos (for example, dirty or mine or read-only)"`
+ Do *DoCmd `arg:"subcommand:do" help:"do something ('git pull', 'build', 'install', etc)"`
+ Config bool `arg:"--config" help:"show your .config/forge/ settings"`
+ // FindAll bool `arg:"--find-all" help:"select every repo"`
+ // FindReadOnly bool `arg:"--find-readonly" help:"include read-only repos"`
+ // 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"`
+ 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"`
+ DryRun bool `arg:"--dry-run" help:"show what would be run"`
+ Fix bool `arg:"--fix" help:"fix config, save config & exit"`
+ Delete string `arg:"--delete" help:"delete this repo"`
+ Dirty bool `arg:"--dirty" help:"git CheckDirty() on every repo"`
+ User bool `arg:"--user" help:"git checkout user"`
+ Master bool `arg:"--master" help:"git checkout master"`
+ URL string `arg:"--connect" help:"gowebd url"`
+ Register string `arg:"--register" help:"register your git URL (foo.com/mystuff) or (github.com/foo/bar)"`
}
func (args) Version() string {