diff options
| author | Jeff Carr <[email protected]> | 2024-11-21 02:24:31 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-21 02:24:31 -0600 |
| commit | 6d4a1be367c52c70febe70479127bfc1330a7676 (patch) | |
| tree | 5c79ff160fd8b2932d0964b6ad7f3a880e9fa460 /forgeConfig | |
| parent | 9617f8f174acc6099bf598477efb00931938d985 (diff) | |
add more config file options
Diffstat (limited to 'forgeConfig')
| -rw-r--r-- | forgeConfig/Makefile | 4 | ||||
| -rw-r--r-- | forgeConfig/argv.go | 21 | ||||
| -rw-r--r-- | forgeConfig/main.go | 16 |
3 files changed, 26 insertions, 15 deletions
diff --git a/forgeConfig/Makefile b/forgeConfig/Makefile index ddf8079..a83e4cc 100644 --- a/forgeConfig/Makefile +++ b/forgeConfig/Makefile @@ -7,6 +7,10 @@ build: ./forgeConfig FORGE_HOME=/tmp/forge ./forgeConfig +install: + GO111MODULE=off go install \ + -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" + test: ./forgeConfig --list ./forgeConfig --add --gopath 'go.wit.com/apps/foo' diff --git a/forgeConfig/argv.go b/forgeConfig/argv.go index 6493284..5e01d4f 100644 --- a/forgeConfig/argv.go +++ b/forgeConfig/argv.go @@ -9,15 +9,18 @@ import ( var argv args type args struct { - ConfigDir string `arg:"env:FORGE_HOME" help:"defaults to ~/.config/forge/"` - List bool `arg:"--list" default:"false" help:"list repos in your config"` - Add bool `arg:"--add" default:"false" help:"add a new repo"` - Delete bool `arg:"--delete" default:"false" help:"delete a repo"` - Update bool `arg:"--update" default:"false" help:"update a repo"` - Directory bool `arg:"--directory" default:"false" help:"repo is a directory to match against"` - ReadOnly bool `arg:"--readonly" default:"false" help:"repo is readonly"` - Writable bool `arg:"--writable" default:"false" help:"repo is writable"` - GoPath string `arg:"--gopath" help:"gopath of the repo"` + ConfigDir string `arg:"env:FORGE_HOME" help:"defaults to ~/.config/forge/"` + List bool `arg:"--list" default:"false" help:"list repos in your config"` + Add bool `arg:"--add" default:"false" help:"add a new repo"` + Delete bool `arg:"--delete" default:"false" help:"delete a repo"` + Update bool `arg:"--update" default:"false" help:"update a repo"` + GoPath string `arg:"--gopath" help:"gopath of the repo"` + Directory bool `arg:"--directory" default:"false" help:"repo is a directory to match against"` + ReadOnly bool `arg:"--readonly" default:"false" help:"repo is readonly"` + Writable bool `arg:"--writable" default:"false" help:"repo is writable"` + Favorite bool `arg:"--favorite" default:"false" help:"forge will always go-clone or git clone this"` + Private bool `arg:"--private" default:"false" help:"repo can not be published"` + Interesting bool `arg:"--interesting" default:"false" help:"something you decided was cool"` } func (a args) Description() string { diff --git a/forgeConfig/main.go b/forgeConfig/main.go index 237698c..cd07016 100644 --- a/forgeConfig/main.go +++ b/forgeConfig/main.go @@ -52,12 +52,16 @@ func main() { // try to add, then save config and exit if argv.Add { log.Info("going to add a new repo", argv.GoPath) - new1 := new(forgepb.Repo) - new1.GoPath = argv.GoPath - new1.Writable = argv.Writable - new1.ReadOnly = argv.ReadOnly - new1.Directory = argv.Directory - if repos.Append(new1) { + new1 := forgepb.Repo{ + GoPath: argv.GoPath, + Writable: argv.Writable, + ReadOnly: argv.ReadOnly, + Directory: argv.Directory, + Favorite: argv.Favorite, + Interesting: argv.Interesting, + } + + if repos.Append(&new1) { log.Info("added", new1.GoPath, "ok") } else { log.Info("added", new1.GoPath, "failed") |
