diff options
| author | Jeff Carr <[email protected]> | 2025-09-04 14:44:35 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-04 14:44:35 -0500 |
| commit | fc6b049b37fc7a282958c2cbca19724a5b8ddc77 (patch) | |
| tree | 334075c9eee7ffb90f8c0b444a4cadb3121c996d /buildPlugin.go | |
| parent | 1096571f39c8019153ea62910a7bc370b25bd9f1 (diff) | |
help the user build the pluginsv0.0.16
Diffstat (limited to 'buildPlugin.go')
| -rw-r--r-- | buildPlugin.go | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/buildPlugin.go b/buildPlugin.go new file mode 100644 index 0000000..07500d9 --- /dev/null +++ b/buildPlugin.go @@ -0,0 +1,64 @@ +package fhelp + +import ( + "bufio" + "fmt" + "os" + "strings" + + "go.wit.com/lib/gui/shell" + "go.wit.com/log" +) + +func BuildPlugin(pname string) bool { + if CheckProtoc() { + log.Info("You have the right tools for protobufs") + } else { + log.Info("You do not have the right tools for protobufs") + } + + log.Info("") + log.Info("### Error ####") + log.Info("The GUI golang plugins did not load for the", pname) + log.Info("You will have to rebuild them") + log.Info("go-clone go.wit.com/toolkits/<pick one>/") + log.Info("TODO: try to rebuild them here") + log.Info("TODO: falling back to STDIN interface") + log.Info("### Error ####") + log.Info("") + log.Infof("To attempt to build the %s plugin, run:\n", pname) + log.Info("forge --build go.wit.com/toolkits/gocui") + log.Info("") + if !questionUser() { + return false + } + r := shell.RunRealtime([]string{"forge", "--build", "go.wit.com/toolkits/" + pname}) + if r.Error == nil { + log.Info("build worked") + log.Info("You must copy that file to ~/go/lib/go-gui/") + return true + } else { + log.Info("build failed") + } + return false +} + +func questionUser() bool { + log.Info("Would you like to run that now?") + fmt.Fprintf(os.Stdout, "(y)es or (n)o ? ") + + scanner := bufio.NewScanner(os.Stdin) + for scanner.Scan() { + line := scanner.Text() + line = strings.TrimSpace(line) + line = strings.ToLower(line) + switch line { + case "y": + return true + case "n": + return false + default: + } + } + return false +} |
