Permalink
Browse files

cocoa -> osascript for prompt driver name

  • Loading branch information...
lox committed Dec 3, 2015
1 parent fa4259b commit 474ec485b69db0c9c3669f9c54c0b5e40435a9e5
Showing with 3 additions and 8 deletions.
  1. +2 −2 prompt/{cocoa.go → osascript.go}
  2. +1 −6 prompt/prompt.go
@@ -8,7 +8,7 @@ import (
"strings"
)
func CocoaPrompt(prompt string) (string, error) {
func OSAScriptPrompt(prompt string) (string, error) {
cmd := exec.Command("/usr/bin/osascript", "-e", fmt.Sprintf(`
display dialog "%s" default answer "" buttons {"OK", "Cancel"} default button 1
text returned of the result
@@ -24,5 +24,5 @@ func CocoaPrompt(prompt string) (string, error) {
}
func init() {
Methods["cocoa"] = CocoaPrompt
Methods["osascript"] = OSAScriptPrompt
}
View
@@ -1,18 +1,13 @@
package prompt
import (
"errors"
"fmt"
)
import "fmt"
type PromptFunc func(string) (string, error)
var Methods = map[string]PromptFunc{
"terminal": TerminalPrompt,
}
var errPromptAborted = errors.New("User cancelled prompt with no value")
func Available() []string {
methods := []string{}
for k := range Methods {

0 comments on commit 474ec48

Please sign in to comment.