zenity/entry_unix.go

25 lines
564 B
Go
Raw Normal View History

2021-04-11 22:59:08 -04:00
// +build !windows,!darwin,!js
2021-03-05 08:56:16 -05:00
package zenity
import (
"github.com/ncruces/zenity/internal/zenutil"
)
2021-04-29 11:05:28 -04:00
func entry(text string, opts options) (string, error) {
2021-04-08 11:43:14 -04:00
args := []string{"--entry", "--text", text}
args = appendTitle(args, opts)
args = appendButtons(args, opts)
args = appendWidthHeight(args, opts)
args = appendIcon(args, opts)
if opts.entryText != "" {
args = append(args, "--entry-text", opts.entryText)
2021-03-05 08:56:16 -05:00
}
2021-03-05 10:14:30 -05:00
if opts.hideText {
args = append(args, "--hide-text")
}
2021-03-05 08:56:16 -05:00
out, err := zenutil.Run(opts.ctx, args)
2021-04-08 11:43:14 -04:00
return strResult(opts, out, err)
2021-03-05 21:07:00 -05:00
}