add more config file options
This commit is contained in:
parent
9617f8f174
commit
6d4a1be367
|
@ -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'
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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")
|
||||
|
|
18
repo.proto
18
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'
|
||||
|
|
Loading…
Reference in New Issue