Use json to quote strings.

This commit is contained in:
Nuno Cruces 2022-05-05 13:03:53 +01:00
parent 17827d3b70
commit e34f649c02
2 changed files with 12 additions and 10 deletions

View file

@ -55,13 +55,13 @@ fmt.stringFromDate(date.dateValue)
var app=Application.currentApplication()
app.includeStandardAdditions=true
app.activate()
ObjC.import("stdlib")
ObjC.import("stdio")
var opt={{json .Options}}
ObjC.import('stdio')
ObjC.import('stdlib')
var opts={{json .Options}}
{{- if .IconPath}}
opt["withIcon"]=Path("{{.IconPath}}")
opts.withIcon=Path({{json .IconPath}})
{{- end}}
var res=app.{{.Operation}}({{json .Text}},opt)
var res=app.{{.Operation}}({{json .Text}},opts)
if(res.gaveUp){$.exit(5)}
if(res.buttonReturned==={{json .Extra}}){$.puts(res.buttonReturned)
$.exit(1)}

View file

@ -2,13 +2,15 @@ var app = Application.currentApplication()
app.includeStandardAdditions = true
app.activate()
ObjC.import("stdlib")
ObjC.import("stdio")
var opt = {{json .Options}}
ObjC.import('stdio')
ObjC.import('stdlib')
var opts = {{json .Options}}
{{- if .IconPath}}
opt["withIcon"] = Path("{{.IconPath}}")
opts.withIcon = Path({{json .IconPath}})
{{- end}}
var res = app.{{.Operation}}({{json .Text}}, opt)
var res = app.{{.Operation}}({{json .Text}}, opts)
if (res.gaveUp) {
$.exit(5)
}