summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--argv.go13
-rw-r--r--doGoWork.go24
-rw-r--r--subCommand.go16
3 files changed, 40 insertions, 13 deletions
diff --git a/argv.go b/argv.go
index 93ee966..b0d3799 100644
--- a/argv.go
+++ b/argv.go
@@ -99,12 +99,13 @@ type CommitCmd struct {
}
type DevCmd struct {
- Build *EmptyCmd `arg:"subcommand:build" help:"build this repo"`
- Install *EmptyCmd `arg:"subcommand:install" help:"build & install this repo"`
- Fixer *FixCmd `arg:"subcommand:fixer" help:"send in the fixer"`
- URL string `arg:"--connect" help:"forge url"`
- Stats *StatsCmd `arg:"subcommand:stats" help:"generate origin.pb"`
- Namespace *EmptyCmd `arg:"subcommand:namespace" help:"check the namespaces"`
+ Build *EmptyCmd `arg:"subcommand:build" help:"build this repo"`
+ Install *EmptyCmd `arg:"subcommand:install" help:"build & install this repo"`
+ GoWork *EmptyCmd `arg:"subcommand:gowork" help:"make a go.work"`
+ Fixer *FixCmd `arg:"subcommand:fixer" help:"send in the fixer"`
+ URL string `arg:"--connect" help:"forge url"`
+ Stats *StatsCmd `arg:"subcommand:stats" help:"generate origin.pb"`
+ Namespace *EmptyCmd `arg:"subcommand:namespace" help:"check the namespaces"`
}
type GenerateCmd struct {
diff --git a/doGoWork.go b/doGoWork.go
new file mode 100644
index 0000000..ca17006
--- /dev/null
+++ b/doGoWork.go
@@ -0,0 +1,24 @@
+package main
+
+import (
+ "fmt"
+ "path/filepath"
+
+ "go.wit.com/lib/env"
+ "go.wit.com/lib/gui/shell"
+ "go.wit.com/log"
+)
+
+func doGoWork() (string, error) {
+ if env.True("GoWork") {
+ s := fmt.Sprintf("Creating %s", filepath.Join(env.Get("gopath"), "go.work"))
+ shell.PathRun(env.Get("gopath"), []string{"mv", "go.work", "go.work.last"})
+ err := me.forge.MakeGoWork()
+ shell.PathRun(env.Get("gopath"), []string{"go", "work", "use"})
+ log.Info("")
+ log.Info("original go.work file saved as go.work.last")
+ log.Info("")
+ return s, err
+ }
+ return "Not working with a go.work file", nil
+}
diff --git a/subCommand.go b/subCommand.go
index be19e18..4d4d4e0 100644
--- a/subCommand.go
+++ b/subCommand.go
@@ -11,11 +11,6 @@ func doSubcommand() (string, error) {
var s string
var err error
- if argv.Dev != nil {
- // first find the repos or gopaths to operate on
- s, err = doDev()
- }
-
if argv.Commit != nil {
s, err = doCommit()
}
@@ -25,18 +20,25 @@ func doSubcommand() (string, error) {
}
if argv.Dev != nil {
- s, err = doDev()
-
if argv.Dev.Fixer != nil {
s, err = doFix(argv.Dev.Fixer)
+ return s, err
}
if argv.Dev.Stats != nil {
s, err = doStats(argv.Dev.Stats)
+ return s, err
}
if argv.Dev.Namespace != nil {
s, err = doVerifyNamespace()
+ return s, err
+ }
+ if argv.Dev.GoWork != nil {
+ s, err = doGoWork()
+ return s, err
}
+
+ s, err = doDev()
}
if argv.Clean != nil {