summaryrefslogtreecommitdiff
path: root/scanGoSrc/argv.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-27 21:40:06 -0600
committerJeff Carr <[email protected]>2024-11-27 21:40:06 -0600
commited3eacfe75e479e8c36cf7ba82a431c567f83602 (patch)
tree450d0cc89758efd161c426868d6cbc6e4ef470d0 /scanGoSrc/argv.go
parent8b987962ea21a827d50e7f7430ab58b47274ad0e (diff)
first attempt that seems to kinda work on New()
Diffstat (limited to 'scanGoSrc/argv.go')
-rw-r--r--scanGoSrc/argv.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/scanGoSrc/argv.go b/scanGoSrc/argv.go
new file mode 100644
index 0000000..5e01d4f
--- /dev/null
+++ b/scanGoSrc/argv.go
@@ -0,0 +1,50 @@
+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"`
+ 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 {
+ 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)
+ }
+}