summaryrefslogtreecommitdiff
path: root/forgeConfig/argv.go
diff options
context:
space:
mode:
Diffstat (limited to 'forgeConfig/argv.go')
-rw-r--r--forgeConfig/argv.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/forgeConfig/argv.go b/forgeConfig/argv.go
new file mode 100644
index 0000000..44aff23
--- /dev/null
+++ b/forgeConfig/argv.go
@@ -0,0 +1,43 @@
+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"`
+ Name string `arg:"--name" help:"name of the repo"`
+ 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)
+ }
+}