File tree 2 files changed +3
-8
lines changed
2 files changed +3
-8
lines changed Original file line number Diff line number Diff line change 8
8
"strings"
9
9
)
10
10
11
- func CocoaPrompt (prompt string ) (string , error ) {
11
+ func OSAScriptPrompt (prompt string ) (string , error ) {
12
12
cmd := exec .Command ("/usr/bin/osascript" , "-e" , fmt .Sprintf (`
13
13
display dialog "%s" default answer "" buttons {"OK", "Cancel"} default button 1
14
14
text returned of the result
@@ -24,5 +24,5 @@ func CocoaPrompt(prompt string) (string, error) {
24
24
}
25
25
26
26
func init () {
27
- Methods ["cocoa " ] = CocoaPrompt
27
+ Methods ["osascript " ] = OSAScriptPrompt
28
28
}
Original file line number Diff line number Diff line change 1
1
package prompt
2
2
3
- import (
4
- "errors"
5
- "fmt"
6
- )
3
+ import "fmt"
7
4
8
5
type PromptFunc func (string ) (string , error )
9
6
10
7
var Methods = map [string ]PromptFunc {
11
8
"terminal" : TerminalPrompt ,
12
9
}
13
10
14
- var errPromptAborted = errors .New ("User cancelled prompt with no value" )
15
-
16
11
func Available () []string {
17
12
methods := []string {}
18
13
for k := range Methods {
You can’t perform that action at this time.
0 commit comments