zenity/internal/zenutil/osa_generated.go

81 lines
1.7 KiB
Go
Raw Normal View History

2020-01-10 20:41:13 -05:00
// Code generated by zenity; DO NOT EDIT.
// +build darwin
2020-01-19 06:57:05 -05:00
package zenutil
2020-01-10 20:41:13 -05:00
import "html/template"
var scripts = template.Must(template.New("").Parse(`
2020-01-18 23:28:06 -05:00
{{define "color"}}<script>var app = Application.currentApplication()
app.includeStandardAdditions = true
app.activate()
var opts = {}
{{if .Color -}}
opts.defaultColor = {{.Color}}
{{end -}}
var res = app.chooseColor(opts)
if (Array.isArray(res)) {
res[0] = Math.round(255*res[0])
res[1] = Math.round(255*res[1])
res[2] = Math.round(255*res[2])
'rgb('+res+')'
}
</script>{{end}}
2020-01-10 20:41:13 -05:00
{{define "file"}}<script>var app = Application.currentApplication()
app.includeStandardAdditions = true
app.activate()
var opts = {}
2020-01-14 20:04:06 -05:00
{{if .Prompt -}}
2020-01-10 20:41:13 -05:00
opts.withPrompt = {{.Prompt}}
2020-01-14 20:04:06 -05:00
{{end -}}
2020-01-10 20:41:13 -05:00
{{if .Type -}}
opts.ofType = {{.Type}}
{{end -}}
{{if .Name -}}
opts.defaultName = {{.Name}}
{{end -}}
{{if .Location -}}
opts.defaultLocation = {{.Location}}
{{end -}}
2020-01-14 20:04:06 -05:00
{{if .Invisibles -}}
opts.invisibles = {{.Invisibles}}
{{end -}}
{{if .Multiple -}}
opts.multipleSelectionsAllowed = {{.Multiple}}
{{end -}}
2020-01-10 20:41:13 -05:00
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}}`))