2021-04-07 09:16:35 -04:00
|
|
|
// +build !windows,!darwin
|
|
|
|
|
|
|
|
package zenity
|
|
|
|
|
2021-04-08 11:43:14 -04:00
|
|
|
import (
|
|
|
|
"github.com/ncruces/zenity/internal/zenutil"
|
|
|
|
)
|
|
|
|
|
2021-04-07 09:16:35 -04:00
|
|
|
func list(text string, items []string, opts options) (string, bool, 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
|
|
|
}
|