zenity/list_darwin.go

36 lines
987 B
Go
Raw Normal View History

2021-04-07 09:16:35 -04:00
package zenity
import (
"github.com/ncruces/zenity/internal/zenutil"
)
2021-04-29 11:05:28 -04:00
func list(text string, items []string, opts options) (string, error) {
2021-04-07 09:16:35 -04:00
var data zenutil.List
data.Items = items
data.Options.Prompt = &text
data.Options.Title = opts.title
data.Options.OK = opts.okLabel
data.Options.Cancel = opts.cancelLabel
data.Options.Default = opts.defaultItems
data.Options.Empty = !opts.disallowEmpty
out, err := zenutil.Run(opts.ctx, "list", data)
2021-04-08 11:43:14 -04:00
return strResult(opts, out, err)
2021-04-07 09:16:35 -04:00
}
func listMultiple(text string, items []string, opts options) ([]string, error) {
var data zenutil.List
data.Items = items
data.Options.Prompt = &text
data.Options.Title = opts.title
data.Options.OK = opts.okLabel
data.Options.Cancel = opts.cancelLabel
data.Options.Default = opts.defaultItems
data.Options.Empty = !opts.disallowEmpty
data.Options.Multiple = true
data.Separator = zenutil.Separator
out, err := zenutil.Run(opts.ctx, "list", data)
2021-04-08 11:43:14 -04:00
return lstResult(opts, out, err)
2021-04-07 09:16:35 -04:00
}