2020-01-04 22:21:39 -05:00
|
|
|
var app = Application.currentApplication()
|
|
|
|
app.includeStandardAdditions = true
|
|
|
|
app.activate()
|
|
|
|
|
2022-05-06 08:48:31 -04:00
|
|
|
ObjC.import('stdio')
|
|
|
|
ObjC.import('stdlib')
|
|
|
|
|
|
|
|
try {
|
|
|
|
var res = app.{{.Operation}}({{json .Options}})
|
|
|
|
} catch (e) {
|
|
|
|
if (e.errorNumber === -128) $.exit(1)
|
|
|
|
$.dprintf(2, e)
|
|
|
|
$.exit(-1)
|
|
|
|
}
|
|
|
|
|
2020-01-04 22:21:39 -05:00
|
|
|
if (Array.isArray(res)) {
|
2022-05-06 08:48:31 -04:00
|
|
|
res.join({{json .Separator}})
|
2020-01-04 22:21:39 -05:00
|
|
|
} else {
|
2022-05-06 08:48:31 -04:00
|
|
|
res.toString()
|
2020-01-04 22:21:39 -05:00
|
|
|
}
|