zenity/entry.go

36 lines
1 KiB
Go
Raw Normal View History

2021-03-04 21:01:59 -05:00
package zenity
// Entry displays the text entry dialog.
//
2021-03-05 21:07:00 -05:00
// Returns false on cancel, or ErrExtraButton.
2021-03-04 21:01:59 -05:00
//
2021-03-05 10:14:30 -05:00
// Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton,
// Icon, EntryText, HideText.
2021-03-05 21:07:00 -05:00
func Entry(text string, options ...Option) (string, bool, error) {
2021-03-04 21:01:59 -05:00
return entry(text, applyOptions(options))
}
2021-03-05 21:07:00 -05:00
// Password displays the password dialog.
//
// Returns false on cancel, or ErrExtraButton.
//
// Valid options: Title, OKLabel, CancelLabel, ExtraButton, Icon, Username.
func Password(options ...Option) (usr string, pw string, ok bool, err error) {
return password(applyOptions(options))
}
2021-03-04 21:01:59 -05:00
// EntryText returns an Option to set the entry text.
func EntryText(text string) Option {
return funcOption(func(o *options) { o.entryText = text })
}
// HideText returns an Option to hide the entry text.
func HideText() Option {
return funcOption(func(o *options) { o.hideText = true })
}
2021-03-05 21:07:00 -05:00
// Username returns an Option to display the username (Unix only).
func Username() Option {
return funcOption(func(o *options) { o.username = true })
}