summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-09-25 14:04:50 -0500
committerJeff Carr <[email protected]>2025-09-25 14:04:50 -0500
commita377c2ed273412e7a98870b8005a431df16f4380 (patch)
tree4000662c0c7c3f8280df0d5175de22106f3a9805
parent3c6ecda8a18c506a432eb62493523e37bc41c1bc (diff)
autocomplete examplesv0.25.24
-rw-r--r--argv.go44
-rw-r--r--doFind.go12
-rw-r--r--main.go13
3 files changed, 46 insertions, 23 deletions
diff --git a/argv.go b/argv.go
index 2fb7330..f3df632 100644
--- a/argv.go
+++ b/argv.go
@@ -27,19 +27,33 @@ type args struct {
Patch *PatchCmd `arg:"subcommand:patch" help:"make patchsets"`
Pull *PullCmd `arg:"subcommand:pull" help:"run 'git pull'"`
Show *ShowCmd `arg:"subcommand:show" help:"print out things"`
+ Dev *DevCmd `arg:"subcommand:dev" help:"features under development"`
All bool `arg:"--all" help:"git commit --all"`
Force bool `arg:"--force" help:"try to strong-arm things"`
Verbose bool `arg:"--verbose" help:"show more output"`
}
+func (args) Examples() string {
+ var out string
+ out += "forge merge --all # merge all patches to devel & master\n"
+ out += "forge pull --force # 'git pull' on all repos\n"
+ out += "forge normal # the defaults for 'normal' forge distributed development\n"
+ return out
+}
+
+type EmptyCmd struct {
+}
+
+type testCmd string
+
type ShowCmd struct {
Dirty *EmptyCmd `arg:"subcommand:dirty" help:"show dirty git repos"`
- Repo *RepoCmd `arg:"subcommand:repo" help:"print a table of the current repos"`
+ Repo *RepoCmd `arg:"subcommand:repos" help:"print a table of the current repos"`
Tag *TagCmd `arg:"subcommand:tag" help:"show git tags"`
- // Build string `arg:"--build" help:"build a repo"`
- // Install string `arg:"--install" help:"install a repo"`
- // BuildForge bool `arg:"--forge-rebuild" help:"download and rebuild forge"`
- // URL string `arg:"--connect" help:"forge url"`
+}
+
+func (ShowCmd) Examples() string {
+ return "forge show dirty\nforge show repos --all"
}
type RepoCmd struct {
@@ -52,9 +66,6 @@ type RepoCmd struct {
// ReadOnly bool `arg:"--readonly" help:"include read-only repos"`
}
-type EmptyCmd struct {
-}
-
type NormalCmd struct {
On *EmptyCmd `arg:"subcommand:on" help:"turn normal mode on"`
Off *EmptyCmd `arg:"subcommand:off" help:"turn normal mode off"`
@@ -65,11 +76,22 @@ type CommitCmd struct {
All bool `arg:"--all" help:"git commit in all dirty repos"`
}
-type testCmd string
+type DevCmd struct {
+ Build string `arg:"--build" help:"build a repo"`
+ Install string `arg:"--install" help:"install a repo"`
+ BuildForge bool `arg:"--forge-rebuild" help:"download and rebuild forge"`
+ URL string `arg:"--connect" help:"forge url"`
+}
type CleanCmd struct {
- // Verify *EmptyCmd `arg:"subcommand:verify" help:"rescan repo"`
- // Repo string `arg:"--repo" help:"which repo to look at"`
+ Verify *EmptyCmd `arg:"subcommand:fix" help:"try to fix problems"`
+ Repo string `arg:"--repo" help:"which repo to look at"`
+}
+
+// matches
+func (c CleanCmd) Match(partial string) []string {
+ // return repos here
+ return []string{"go.wit.com/apps/forge", "go.wit.com/apps/virtigo"}
}
type CleanDevelCmd struct {
diff --git a/doFind.go b/doFind.go
index 839b93d..66ce22f 100644
--- a/doFind.go
+++ b/doFind.go
@@ -35,6 +35,14 @@ func findRepos() *gitpb.Repos {
return findMine()
}
+ if argv.Show.Dirty != nil {
+ return me.forge.FindDirty()
+ }
+
+ if argv.Show.Repo == nil {
+ return findAll()
+ }
+
if argv.Show.Repo.All {
return findAll()
}
@@ -51,10 +59,6 @@ func findRepos() *gitpb.Repos {
return findFavorites()
}
- if argv.Show.Dirty != nil {
- return me.forge.FindDirty()
- }
-
if argv.Show.Repo.User {
return findUser()
}
diff --git a/main.go b/main.go
index 00da673..46ef9b1 100644
--- a/main.go
+++ b/main.go
@@ -41,18 +41,15 @@ func getVersion(repo *gitpb.Repo, name string) string {
func main() {
me = new(mainType)
- me.myGui = prep.Gui() // prepares the GUI package for go-args
- me.auto = prep.Bash3(&argv) // this line should be: prep.Bash(&argv)
- // me.auto = prep.Bash3(argv.DoAutoComplete, &argv) // this line should be: prep.Bash(&argv)
- // arg.MustParse(&argv) // these three lines are becoming terrible syntax
- // me.auto = prep.MustParse(&argv) // try to make this work?
+ // the current os.Argv processing with go-args
+ me.myGui = prep.Gui() // adds the GUI package args support
+ me.auto = prep.Bash(&argv) // adds auto complete to go-args
+ // the current forge init process
me.forge = forgepb.Init() // init forge.pb
me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes
-
- // initialize patches
- doPatchInit()
+ doPatchInit() // initialize patches
// first find the repos or gopaths to operate on
if argv.Config != nil {