diff --git a/go.mod b/go.mod index 497e5c6..258ec01 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module github.com/ncruces/zenity -go 1.13 +go 1.15 require ( go.uber.org/goleak v1.0.0 // test - golang.org/x/image v0.0.0-20191214001246-9130b4cfad52 + golang.org/x/image v0.0.0-20201208152932-35266b937fa6 golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect golang.org/x/tools v0.0.0-20200129045341-207d3de1faaf // indirect ) diff --git a/go.sum b/go.sum index 347f39e..c04ce53 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,9 @@ +github.com/akavel/rsrc v0.8.0 h1:zjWn7ukO9Kc5Q62DOJCcxGpXC18RawVtYAGdz2aLlfw= +github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/josephspurrier/goversioninfo v1.2.0 h1:tpLHXAxLHKHg/dCU2AAYx08A4m+v9/CWg6+WUvTF4uQ= +github.com/josephspurrier/goversioninfo v1.2.0/go.mod h1:AGP2a+Y/OVJZ+s6XM4IwFUpkETwvn0orYurY8qpw1+0= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -8,14 +12,15 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= go.uber.org/goleak v1.0.0 h1:qsup4IcBdlmsnGfqyLl4Ntn3C2XCCuKAE7DwHpScyUo= go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/image v0.0.0-20191214001246-9130b4cfad52 h1:2fktqPPvDiVEEVT/vSTeoUPXfmRxRaGy6GU8jypvEn0= -golang.org/x/image v0.0.0-20191214001246-9130b4cfad52/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20201208152932-35266b937fa6 h1:nfeHNc1nAqecKCy2FCy4HY+soOOe5sDLJ/gZLbx6GYI= +golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f h1:J5lckAjkw6qYlOZNj90mLYNTEKDvWeuc1yieZ8qUzUE= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= @@ -37,5 +42,6 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/zenutil/osa_generated.go b/internal/zenutil/osa_generated.go index 45298ad..24d2a19 100644 --- a/internal/zenutil/osa_generated.go +++ b/internal/zenutil/osa_generated.go @@ -10,7 +10,8 @@ var scripts = template.Must(template.New("").Funcs(template.FuncMap{"json": func b, err := json.Marshal(v) return string(b), err }}).Parse(` -{{define "color" -}}tell application (path to frontmost application as text) +{{define "color" -}} +tell application (path to frontmost application as text) activate {{if .Color -}} set c to choose color default color { {{index .Color 0}},{{index .Color 1}},{{index .Color 2}} } @@ -20,7 +21,8 @@ set c to choose color "rgb(" & (item 1 of c) div 256 & "," & (item 2 of c) div 256 & "," & (item 3 of c) div 256 & ")" end tell {{- end}} -{{define "file" -}}var app = Application.currentApplication() +{{define "file" -}} +var app = Application.currentApplication() app.includeStandardAdditions = true app.activate() var opts = {} @@ -49,7 +51,8 @@ res.join({{json .Separator}}) res.toString() } {{- end}} -{{define "msg" -}}var app = Application.currentApplication() +{{define "msg" -}} +var app = Application.currentApplication() app.includeStandardAdditions = true app.activate() var opts = {} @@ -88,7 +91,8 @@ res void 0 } {{- end}} -{{define "notify" -}}var app = Application.currentApplication() +{{define "notify" -}} +var app = Application.currentApplication() app.includeStandardAdditions = true app.activate() var opts = {} diff --git a/internal/zenutil/osa_generator.go b/internal/zenutil/osa_generator.go index 07cb08f..39a0c78 100644 --- a/internal/zenutil/osa_generator.go +++ b/internal/zenutil/osa_generator.go @@ -27,7 +27,7 @@ func main() { str.WriteString("\n" + `{{define "`) str.WriteString(strings.TrimSuffix(name, filepath.Ext(name))) - str.WriteString(`" -}}`) + str.WriteString(`" -}}` + "\n") func() { in, err := os.Open(filepath.Join(dir, name)) diff --git a/internal/zenutil/osascripts/file.js b/internal/zenutil/osascripts/file.gojs similarity index 100% rename from internal/zenutil/osascripts/file.js rename to internal/zenutil/osascripts/file.gojs diff --git a/internal/zenutil/osascripts/msg.js b/internal/zenutil/osascripts/msg.gojs similarity index 100% rename from internal/zenutil/osascripts/msg.js rename to internal/zenutil/osascripts/msg.gojs diff --git a/internal/zenutil/osascripts/notify.js b/internal/zenutil/osascripts/notify.gojs similarity index 100% rename from internal/zenutil/osascripts/notify.js rename to internal/zenutil/osascripts/notify.gojs