make Global. duh.
This commit is contained in:
parent
fc6b049b37
commit
b97c502b54
|
@ -1,11 +1,6 @@
|
||||||
package fhelp
|
package fhelp
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"go.wit.com/lib/gui/shell"
|
"go.wit.com/lib/gui/shell"
|
||||||
"go.wit.com/log"
|
"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.Infof("To attempt to build the %s plugin, run:\n", pname)
|
||||||
log.Info("forge --build go.wit.com/toolkits/gocui")
|
log.Info("forge --build go.wit.com/toolkits/gocui")
|
||||||
log.Info("")
|
log.Info("")
|
||||||
if !questionUser() {
|
if !QuestionUser("Would you like to run that now?") {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
r := shell.RunRealtime([]string{"forge", "--build", "go.wit.com/toolkits/" + pname})
|
r := shell.RunRealtime([]string{"forge", "--build", "go.wit.com/toolkits/" + pname})
|
||||||
|
@ -42,23 +37,3 @@ func BuildPlugin(pname string) bool {
|
||||||
}
|
}
|
||||||
return false
|
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
|
|
||||||
}
|
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
Loading…
Reference in New Issue