From 5155f8038eb854c64efafcf5f2e9ef0f88cb6630 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 1 Dec 2024 22:21:34 -0600 Subject: [PATCH] add --build and --install --- Makefile | 4 ++++ main.go | 41 ++++++++++++++++++++++++++++------------- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 7719637..5e380b0 100644 --- a/Makefile +++ b/Makefile @@ -52,6 +52,10 @@ git-clone: test-build: build ./go-clone --build go.wit.com/apps/guireleaser +test-install: build + ./go-clone --install go.wit.com/apps/guireleaser + + debian: go-deb --no-gui --repo go.wit.com/apps/go-clone diff --git a/main.go b/main.go index baa316e..28cf6ac 100644 --- a/main.go +++ b/main.go @@ -82,17 +82,26 @@ func main() { clone() autoWork() - build() - if argv.Repo == "" { - pp.WriteHelp(os.Stdout) - os.Exit(0) + if argv.Install { + if err := forge.Install(argvRepo, nil); err == nil { + okExit("install worked") + } else { + badExit(err) + } } - okExit(argv.Repo) + if argv.Build { + if err := forge.Build(argvRepo, nil); err == nil { + okExit("build worked") + } else { + badExit(err) + } + } + okExit("skipping build of " + argv.Repo) } func okExit(thing string) { - log.Info("Total repositories:", forge.Repos.Len()) - log.Info("Finished go-clone", thing, "ok") + log.Info(thing, "ok") + log.Info("Finished clone on", argvRepo.GetGoPath(), "ok") os.Exit(0) } @@ -199,13 +208,19 @@ func redoGoModAll() { } } -func build() { - if argv.Build { - log.Info("need to try to build here") - forge.Build(argvRepo, nil) - } else { - log.Info("skipping build") +func build() error { + if argv.Install { + if err := forge.Install(argvRepo, nil); err == nil { + okExit("install worked") + } else { + badExit(err) + } } + if argv.Build { + return forge.Build(argvRepo, nil) + } + log.Info("skipping build") + return nil } func autoWork() {