Commit generated code (macos).
This commit is contained in:
parent
36bf362ec9
commit
23c6f30842
4 changed files with 63 additions and 3 deletions
1
internal/osa/.gitignore
vendored
1
internal/osa/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
osa_gen_darwin.go
|
58
internal/osa/generated.go
Normal file
58
internal/osa/generated.go
Normal file
|
@ -0,0 +1,58 @@
|
|||
// 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 = {}
|
||||
opts.withPrompt = {{.Prompt}}
|
||||
opts.multipleSelectionsAllowed = {{.Multiple}}
|
||||
{{if .Type -}}
|
||||
opts.ofType = {{.Type}}
|
||||
{{end -}}
|
||||
{{if .Name -}}
|
||||
opts.defaultName = {{.Name}}
|
||||
{{end -}}
|
||||
{{if .Location -}}
|
||||
opts.defaultLocation = {{.Location}}
|
||||
{{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}}`))
|
|
@ -1,3 +1,5 @@
|
|||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
@ -50,7 +52,7 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
out, err := os.Create("osa_gen_darwin.go")
|
||||
out, err := os.Create("generated.go")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -67,6 +69,7 @@ func main() {
|
|||
}
|
||||
|
||||
var generator = template.Must(template.New("").Parse(`// Code generated by zenity; DO NOT EDIT.
|
||||
// +build darwin
|
||||
|
||||
package osa
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
package osa
|
||||
|
||||
//go:generate go run scripts/generate.go scripts/
|
||||
//go:generate go run generator.go scripts/
|
||||
|
|
Loading…
Reference in a new issue