add more config file options
This commit is contained in:
parent
9617f8f174
commit
6d4a1be367
|
@ -7,6 +7,10 @@ build:
|
||||||
./forgeConfig
|
./forgeConfig
|
||||||
FORGE_HOME=/tmp/forge ./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:
|
test:
|
||||||
./forgeConfig --list
|
./forgeConfig --list
|
||||||
./forgeConfig --add --gopath 'go.wit.com/apps/foo'
|
./forgeConfig --add --gopath 'go.wit.com/apps/foo'
|
||||||
|
|
|
@ -9,15 +9,18 @@ import (
|
||||||
var argv args
|
var argv args
|
||||||
|
|
||||||
type args struct {
|
type args struct {
|
||||||
ConfigDir string `arg:"env:FORGE_HOME" help:"defaults to ~/.config/forge/"`
|
ConfigDir string `arg:"env:FORGE_HOME" help:"defaults to ~/.config/forge/"`
|
||||||
List bool `arg:"--list" default:"false" help:"list repos in your config"`
|
List bool `arg:"--list" default:"false" help:"list repos in your config"`
|
||||||
Add bool `arg:"--add" default:"false" help:"add a new repo"`
|
Add bool `arg:"--add" default:"false" help:"add a new repo"`
|
||||||
Delete bool `arg:"--delete" default:"false" help:"delete a repo"`
|
Delete bool `arg:"--delete" default:"false" help:"delete a repo"`
|
||||||
Update bool `arg:"--update" default:"false" help:"update 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"`
|
GoPath string `arg:"--gopath" help:"gopath of the repo"`
|
||||||
ReadOnly bool `arg:"--readonly" default:"false" help:"repo is readonly"`
|
Directory bool `arg:"--directory" default:"false" help:"repo is a directory to match against"`
|
||||||
Writable bool `arg:"--writable" default:"false" help:"repo is writable"`
|
ReadOnly bool `arg:"--readonly" default:"false" help:"repo is readonly"`
|
||||||
GoPath string `arg:"--gopath" help:"gopath of the repo"`
|
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 {
|
func (a args) Description() string {
|
||||||
|
|
|
@ -52,12 +52,16 @@ func main() {
|
||||||
// try to add, then save config and exit
|
// try to add, then save config and exit
|
||||||
if argv.Add {
|
if argv.Add {
|
||||||
log.Info("going to add a new repo", argv.GoPath)
|
log.Info("going to add a new repo", argv.GoPath)
|
||||||
new1 := new(forgepb.Repo)
|
new1 := forgepb.Repo{
|
||||||
new1.GoPath = argv.GoPath
|
GoPath: argv.GoPath,
|
||||||
new1.Writable = argv.Writable
|
Writable: argv.Writable,
|
||||||
new1.ReadOnly = argv.ReadOnly
|
ReadOnly: argv.ReadOnly,
|
||||||
new1.Directory = argv.Directory
|
Directory: argv.Directory,
|
||||||
if repos.Append(new1) {
|
Favorite: argv.Favorite,
|
||||||
|
Interesting: argv.Interesting,
|
||||||
|
}
|
||||||
|
|
||||||
|
if repos.Append(&new1) {
|
||||||
log.Info("added", new1.GoPath, "ok")
|
log.Info("added", new1.GoPath, "ok")
|
||||||
} else {
|
} else {
|
||||||
log.Info("added", new1.GoPath, "failed")
|
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!
|
// due to the prior apache foundation project. This happens and is ok!
|
||||||
message Repo {
|
message Repo {
|
||||||
string goPath = 1; // Examples: 'go.wit.com/apps/go-clone' or "~/mythings" or "/home/src/foo"
|
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 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 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 private = 4; // if the repo can be published
|
||||||
bool directory = 5; // everything in this directory should use these writable & private values
|
bool directory = 5; // everything in this directory should use these writable & private values
|
||||||
string masterBranch = 6; // git 'main' or 'master' branch name
|
bool favorite = 6; // you like this. always git clone/go clone this repo
|
||||||
string develBranch = 7; // whatever the git 'devel' branch name is
|
bool interesting = 7; // this is something interesting you found and want to remember it
|
||||||
string userBranch = 8; // whatever your username branch is
|
|
||||||
string debname = 9; // this is the actual .deb name of the package
|
string masterBranch = 8; // git 'main' or 'master' branch name
|
||||||
google.protobuf.Timestamp verstamp = 10; // the git commit timestamp of the version
|
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'
|
// TODO: autogen 'Repos'
|
||||||
|
|
Loading…
Reference in New Issue