zenity/entry_unix.go

23 lines
583 B
Go
Raw Permalink Normal View History

2022-03-24 10:37:37 -04:00
//go:build !windows && !darwin
2021-03-05 08:56:16 -05:00
package zenity
2022-12-20 07:23:15 -05:00
import "github.com/ncruces/zenity/internal/zenutil"
2021-03-05 08:56:16 -05:00
2021-04-29 11:05:28 -04:00
func entry(text string, opts options) (string, error) {
2022-12-20 07:23:15 -05:00
args := []string{"--entry", "--text", quoteMnemonics(text)}
2022-06-02 07:24:24 -04:00
args = appendGeneral(args, opts)
2021-04-08 11:43:14 -04:00
args = appendButtons(args, opts)
args = appendWidthHeight(args, opts)
2022-05-18 09:48:09 -04:00
args = appendWindowIcon(args, opts)
2021-04-08 11:43:14 -04:00
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
}