zenity/entry_unix.go

25 lines
570 B
Go
Raw Permalink 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-03-05 21:07:00 -05:00
func entry(text string, opts options) (string, bool, 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
}