summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-03 04:21:30 -0500
committerJeff Carr <[email protected]>2025-10-03 04:21:30 -0500
commit3bc358f5d32368f03e7ac2c528c37bf5d7f7847c (patch)
tree70aee53238d75a869bd7d8bbbfbaedbbc8b5a4f5
parentc7dd868ffcecba5fa319bb2364e0adebdda64030 (diff)
new argv lib
-rw-r--r--argv.go39
-rw-r--r--main.go3
2 files changed, 15 insertions, 27 deletions
diff --git a/argv.go b/argv.go
index 8089cc8..c20b338 100644
--- a/argv.go
+++ b/argv.go
@@ -15,13 +15,13 @@ import (
var argv args
type args struct {
- Repo string `arg:"positional" help:"go import path"`
- AutoWork bool `arg:"--work" default:"false" help:"recreate the go.work file"`
- DryRun bool `arg:"--dry-run" help:"show what would be run"`
- Recursive bool `arg:"--recursive" default:"true" help:"recursively clone all dependencies"`
- Build bool `arg:"--build" help:"try to build it after clone"`
- Install bool `arg:"--install" help:"try to install it after clone"`
- Ignore bool `arg:"--ignore" default:"false" help:"ignore weird clone errors from non-standard repos"`
+ Repo string `arg:"positional" help:"go import path"`
+ AutoWork bool `arg:"--work" default:"false" help:"recreate the go.work file"`
+ DryRun bool `arg:"--dry-run" help:"show what would be run"`
+ NonRecursive bool `arg:"--non-recursive" help:"recursively clone all dependencies"`
+ Build bool `arg:"--build" help:"try to build it after clone"`
+ Install bool `arg:"--install" help:"try to install it after clone"`
+ Ignore bool `arg:"--ignore" default:"false" help:"ignore weird clone errors from non-standard repos"`
// Fetch bool `arg:"--git-fetch" default:"false" help:"run 'git fetch' on all your repos"`
}
@@ -29,6 +29,10 @@ func (args) Version() string {
return "go-clone " + VERSION + " Built on " + BUILDTIME
}
+func (args) Buildtime() (string, string) {
+ return BUILDTIME, VERSION
+}
+
func (a args) Description() string {
return `
git clone go repositories recursively
@@ -38,23 +42,6 @@ Examples:
`
}
-/*
-func (a args) DoAutoComplete(argv []string) {
- switch argv[0] {
- case "checkout":
- fmt.Println("user devel master ")
- case "--recursive":
- fmt.Println("true false")
- default:
- if argv[0] == ARGNAME {
- // list the subcommands here
- fmt.Println("--dry-run --recursive --work")
- }
- }
- os.Exit(0)
-}
-*/
-
func (args) Appname() string {
return ARGNAME
}
@@ -63,9 +50,9 @@ func (a args) DoAutoComplete(pb *prep.Auto) {
// fmt.Fprintf(os.Stderr, "blah\n")
// fmt.Fprintf(os.Stderr, "\n")
if pb.Cmd == "" {
- pb.Autocomplete3([]string{"--dry-run", "--recursive", "--work"})
+ pb.Autocomplete3([]string{"--dry-run", "--non-recursive", "--work", "--version"})
} else {
- pb.SubCommand(pb.Argv...)
+ pb.SubCommand(pb.Goargs...)
}
os.Exit(0)
}
diff --git a/main.go b/main.go
index 1a4fd50..f399273 100644
--- a/main.go
+++ b/main.go
@@ -36,7 +36,8 @@ func main() {
if err != nil {
badExit(err)
}
- if argv.Recursive {
+
+ if !argv.NonRecursive {
log.Info("STARTING RECURSIVE CLONE", workingRepo.GetGoPath())
if err := recursiveClone(workingRepo); err != nil {
badExit(err)