2022-03-24 10:37:37 -04:00
|
|
|
//go:build !windows && !darwin
|
2021-04-07 09:16:35 -04:00
|
|
|
|
|
|
|
package zenity
|
|
|
|
|
2021-04-08 11:43:14 -04:00
|
|
|
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-08 11:43:14 -04:00
|
|
|
args := []string{"--list", "--column=", "--hide-header", "--text", text}
|
|
|
|
args = appendTitle(args, opts)
|
|
|
|
args = appendButtons(args, opts)
|
|
|
|
args = appendWidthHeight(args, opts)
|
|
|
|
args = appendIcon(args, opts)
|
|
|
|
args = append(args, items...)
|
|
|
|
|
|
|
|
out, err := zenutil.Run(opts.ctx, args)
|
|
|
|
return strResult(opts, out, err)
|
2021-04-07 09:16:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func listMultiple(text string, items []string, opts options) ([]string, error) {
|
2021-04-08 11:43:14 -04:00
|
|
|
args := []string{"--list", "--column=", "--hide-header", "--text", text, "--multiple", "--separator", zenutil.Separator}
|
|
|
|
args = appendTitle(args, opts)
|
|
|
|
args = appendButtons(args, opts)
|
|
|
|
args = appendWidthHeight(args, opts)
|
|
|
|
args = appendIcon(args, opts)
|
|
|
|
args = append(args, items...)
|
|
|
|
|
|
|
|
out, err := zenutil.Run(opts.ctx, args)
|
|
|
|
return lstResult(opts, out, err)
|
2021-04-07 09:16:35 -04:00
|
|
|
}
|