zenity/internal/zenutil/osascripts/dialog.gojs
2022-05-09 15:50:25 +01:00

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