65 lines
1.4 KiB
Go
65 lines
1.4 KiB
Go
// Code generated by zenity; DO NOT EDIT.
|
|
// +build darwin
|
|
|
|
package osa
|
|
|
|
import "html/template"
|
|
|
|
var scripts = template.Must(template.New("").Parse(`
|
|
{{define "file"}}<script>var app = Application.currentApplication()
|
|
app.includeStandardAdditions = true
|
|
app.activate()
|
|
var opts = {}
|
|
{{if .Prompt -}}
|
|
opts.withPrompt = {{.Prompt}}
|
|
{{end -}}
|
|
{{if .Type -}}
|
|
opts.ofType = {{.Type}}
|
|
{{end -}}
|
|
{{if .Name -}}
|
|
opts.defaultName = {{.Name}}
|
|
{{end -}}
|
|
{{if .Location -}}
|
|
opts.defaultLocation = {{.Location}}
|
|
{{end -}}
|
|
{{if .Invisibles -}}
|
|
opts.invisibles = {{.Invisibles}}
|
|
{{end -}}
|
|
{{if .Multiple -}}
|
|
opts.multipleSelectionsAllowed = {{.Multiple}}
|
|
{{end -}}
|
|
var res = app[{{.Operation}}](opts)
|
|
if (Array.isArray(res)) {
|
|
res.join({{.Separator}})
|
|
} else {
|
|
res.toString()
|
|
}
|
|
</script>{{end}}
|
|
{{define "msg"}}<script>var app = Application.currentApplication()
|
|
app.includeStandardAdditions = true
|
|
app.activate()
|
|
var opts = {}
|
|
{{if .Message -}}
|
|
opts.message = {{.Message}}
|
|
{{end -}}
|
|
{{if .As -}}
|
|
opts.as = {{.As}}
|
|
{{end -}}
|
|
{{if .Title -}}
|
|
opts.withTitle = {{.Title}}
|
|
{{end -}}
|
|
{{if .Icon -}}
|
|
opts.withIcon = {{.Icon}}
|
|
{{end -}}
|
|
{{if .Buttons -}}
|
|
opts.buttons = {{.Buttons}}
|
|
{{end -}}
|
|
{{if .Default -}}
|
|
opts.defaultButton = {{.Default}}
|
|
{{end -}}
|
|
{{if .Cancel -}}
|
|
opts.cancelButton = {{.Cancel}}
|
|
{{end -}}
|
|
var res = app[{{.Operation}}]({{.Text}}, opts).buttonReturned
|
|
res === {{.Extra}} ? res : void 0
|
|
</script>{{end}}`))
|