summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-15 09:29:49 -0600
committerJeff Carr <[email protected]>2024-11-15 09:29:49 -0600
commitf8bef3081c7ca36b2970514401f2871039e99324 (patch)
treedc22d6ca6830a46035ceb601a3e12dba7946283b /main.go
parentbef6d6c911acacceeef8390c8e8d9d91584f7a61 (diff)
add --auto-work option to generate go.work files
Diffstat (limited to 'main.go')
-rw-r--r--main.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/main.go b/main.go
index 26cff91..5f275f6 100644
--- a/main.go
+++ b/main.go
@@ -68,7 +68,7 @@ func main() {
} else {
trycount += 1
log.Info("actually run: git pull:", repo.Status.Path())
- if result := repo.Status.Run(pull); result.Error != nil {
+ if result := shell.PathRunRealtime(repo.Status.Path(), pull); result.Error != nil {
log.Info("git pull error:", result.Error)
errcount += 1
}
@@ -78,8 +78,8 @@ func main() {
os.Exit(0)
}
- // if the user didn't provide a repo, stop here
- if argv.Repo == "" {
+ // if the user didn't provide a repo, stop here unless --git-pull
+ if argv.Repo == "" || argv.Pull {
pp.WriteHelp(os.Stdout)
os.Exit(0)
}
@@ -93,11 +93,9 @@ func main() {
newr.Status.MakeRedomod()
fullgitdir = filepath.Join(wdir, argv.Repo, ".git")
- if shell.IsDir(fullgitdir) {
- if ! argv.Recursive {
- log.Info("repo already cloned", filepath.Join(wdir, argv.Repo))
- os.Exit(0)
- }
+ if ! shell.IsDir(fullgitdir) {
+ log.Info("repo cloned failed", filepath.Join(wdir, argv.Repo))
+ os.Exit(-1)
}
log.Info("scanning for repo in:", filepath.Join(wdir, argv.Repo))
@@ -134,7 +132,7 @@ func main() {
log.Info("Total repositories:", count)
log.Info("Finished go-clone for", argv.Repo)
- if !argv.NoWork {
+ if argv.AutoWork {
log.Info("Creating", wdir+"/go.work")
rv.MakeGoWork()
shell.PathRun(wdir, []string{"go", "work", "use"})