make Global. duh.

This commit is contained in:
Jeff Carr 2025-09-06 20:08:54 -05:00
parent fc6b049b37
commit b97c502b54
2 changed files with 31 additions and 26 deletions

View File

@ -1,11 +1,6 @@
package fhelp
import (
"bufio"
"fmt"
"os"
"strings"
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
@ -29,7 +24,7 @@ func BuildPlugin(pname string) bool {
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() {
if !QuestionUser("Would you like to run that now?") {
return false
}
r := shell.RunRealtime([]string{"forge", "--build", "go.wit.com/toolkits/" + pname})
@ -42,23 +37,3 @@ func BuildPlugin(pname string) bool {
}
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
}

30
questionUser.go Normal file
View File

@ -0,0 +1,30 @@
package fhelp
import (
"bufio"
"fmt"
"os"
"strings"
"go.wit.com/log"
)
func QuestionUser(msg string) bool {
log.Info(msg)
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
}