21 lines
No EOL
425 B
Text
21 lines
No EOL
425 B
Text
var app = Application.currentApplication()
|
|
app.includeStandardAdditions = true
|
|
app.activate()
|
|
|
|
ObjC.import('stdio')
|
|
ObjC.import('stdlib')
|
|
|
|
var opts = {{json .Options}}
|
|
{{- if .IconPath}}
|
|
opts.withIcon = Path({{json .IconPath}})
|
|
{{- end}}
|
|
|
|
var res = app.{{.Operation}}({{json .Text}}, opts)
|
|
if (res.gaveUp) {
|
|
$.exit(5)
|
|
}
|
|
if (res.buttonReturned === {{json .Extra}}) {
|
|
$.puts(res.buttonReturned)
|
|
$.exit(1)
|
|
}
|
|
res.textReturned |