diff options
| author | Jeff Carr <[email protected]> | 2025-11-01 12:15:23 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-11-01 12:15:23 -0500 | 
| commit | 8c1eea72a59ea1d75b6e781f4bc87e328f6336a7 (patch) | |
| tree | 9a0b6396fc48859bc87d97b3d78d34537d5561c6 | |
| parent | e1a3c160a5b13ff874df75938cbe62e81bef1ec2 (diff) | |
| -rw-r--r-- | argv.go | 13 | ||||
| -rw-r--r-- | doGoWork.go | 24 | ||||
| -rw-r--r-- | subCommand.go | 16 | 
3 files changed, 40 insertions, 13 deletions
@@ -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 {  | 
