From 6d4a1be367c52c70febe70479127bfc1330a7676 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 21 Nov 2024 02:24:31 -0600 Subject: [PATCH] add more config file options --- forgeConfig/Makefile | 4 ++++ forgeConfig/argv.go | 21 ++++++++++++--------- forgeConfig/main.go | 16 ++++++++++------ repo.proto | 18 +++++++++++++----- 4 files changed, 39 insertions(+), 20 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") diff --git a/repo.proto b/repo.proto index 4b087b4..cef8607 100644 --- a/repo.proto +++ b/repo.proto @@ -12,15 +12,23 @@ import "google/protobuf/timestamp.proto"; // Import the well-known type for Time // due to the prior apache foundation project. This happens and is ok! message Repo { string goPath = 1; // Examples: 'go.wit.com/apps/go-clone' or "~/mythings" or "/home/src/foo" + bool writable = 2; // if you have write access to the repo bool readOnly = 3; // the opposite, but needed for now because I don't know what I'm doing bool private = 4; // if the repo can be published bool directory = 5; // everything in this directory should use these writable & private values - string masterBranch = 6; // git 'main' or 'master' branch name - string develBranch = 7; // whatever the git 'devel' branch name is - string userBranch = 8; // whatever your username branch is - string debname = 9; // this is the actual .deb name of the package - google.protobuf.Timestamp verstamp = 10; // the git commit timestamp of the version + bool favorite = 6; // you like this. always git clone/go clone this repo + bool interesting = 7; // this is something interesting you found and want to remember it + + string masterBranch = 8; // git 'main' or 'master' branch name + string develBranch = 9; // whatever the git 'devel' branch name is + string userBranch = 10; // whatever your username branch is + + string debname = 11; // the actual name used with 'apt install' (or distro apt equivalent. +// todo: appeal to everyone to alias 'apt' on rhat, gentoo, arch, etc to alias 'apt install' +// so we can make easier instructions for new linux users. KISS + + google.protobuf.Timestamp verstamp = 12; // the git commit timestamp of the version } // TODO: autogen 'Repos'