forgepb/forgeConfig/argv.go

48 lines
1.4 KiB
Go
Raw Normal View History

2024-11-20 12:11:13 -06:00
package main
import (
"os"
"github.com/alexflint/go-arg"
)
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"`
2024-11-20 23:51:28 -06:00
Delete bool `arg:"--delete" default:"false" help:"delete a repo"`
2024-11-20 13:43:26 -06:00
Update bool `arg:"--update" default:"false" help:"update a repo"`
2024-11-20 23:51:28 -06:00
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"`
2024-11-20 12:11:13 -06:00
GoPath string `arg:"--gopath" help:"gopath of the repo"`
}
func (a args) Description() string {
return `
forgeConfig -- add entries to your config files
This is just example protobuf code to test forgepb is working
but it could be used to automagically create a config file too.
If you need to change your config file, just edit the forge.text or forge.json
files then remove the forge.pb and ConfigLoad() will attempt to load those files instead
`
}
func (args) Version() string {
return "virtigo " + VERSION
}
func init() {
var pp *arg.Parser
pp = arg.MustParse(&argv)
if pp == nil {
pp.WriteHelp(os.Stdout)
os.Exit(0)
}
}