Documentation, fix #24.

This commit is contained in:
Nuno Cruces 2022-03-26 00:58:27 +00:00
parent 2c6ebc3c19
commit 0e246b3d91
7 changed files with 30 additions and 0 deletions

View file

@ -5,6 +5,8 @@ import "image/color"
// SelectColor displays the color selection dialog. // SelectColor displays the color selection dialog.
// //
// Valid options: Title, Color, ShowPalette. // Valid options: Title, Color, ShowPalette.
//
// May return: ErrCanceled.
func SelectColor(options ...Option) (color.Color, error) { func SelectColor(options ...Option) (color.Color, error) {
return selectColor(applyOptions(options)) return selectColor(applyOptions(options))
} }

View file

@ -4,6 +4,8 @@ package zenity
// //
// Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton, // Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton,
// Icon, EntryText, HideText. // Icon, EntryText, HideText.
//
// May return: ErrCanceled, ErrExtraButton.
func Entry(text string, options ...Option) (string, error) { func Entry(text string, options ...Option) (string, error) {
return entry(text, applyOptions(options)) return entry(text, applyOptions(options))
} }

View file

@ -9,6 +9,8 @@ import (
// SelectFile displays the file selection dialog. // SelectFile displays the file selection dialog.
// //
// Valid options: Title, Directory, Filename, ShowHidden, FileFilter(s). // Valid options: Title, Directory, Filename, ShowHidden, FileFilter(s).
//
// May return: ErrCanceled.
func SelectFile(options ...Option) (string, error) { func SelectFile(options ...Option) (string, error) {
return selectFile(applyOptions(options)) return selectFile(applyOptions(options))
} }
@ -16,6 +18,8 @@ func SelectFile(options ...Option) (string, error) {
// SelectFileMutiple displays the multiple file selection dialog. // SelectFileMutiple displays the multiple file selection dialog.
// //
// Valid options: Title, Directory, Filename, ShowHidden, FileFilter(s). // Valid options: Title, Directory, Filename, ShowHidden, FileFilter(s).
//
// May return: ErrCanceled, ErrUnsupported.
func SelectFileMutiple(options ...Option) ([]string, error) { func SelectFileMutiple(options ...Option) ([]string, error) {
return selectFileMutiple(applyOptions(options)) return selectFileMutiple(applyOptions(options))
} }
@ -24,6 +28,8 @@ func SelectFileMutiple(options ...Option) ([]string, error) {
// //
// Valid options: Title, Filename, ConfirmOverwrite, ConfirmCreate, ShowHidden, // Valid options: Title, Filename, ConfirmOverwrite, ConfirmCreate, ShowHidden,
// FileFilter(s). // FileFilter(s).
//
// May return: ErrCanceled.
func SelectFileSave(options ...Option) (string, error) { func SelectFileSave(options ...Option) (string, error) {
return selectFileSave(applyOptions(options)) return selectFileSave(applyOptions(options))
} }

View file

@ -4,11 +4,15 @@ package zenity
// //
// Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton, // Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton,
// Icon, DefaultItems, DisallowEmpty. // Icon, DefaultItems, DisallowEmpty.
//
// May return: ErrCanceled, ErrExtraButton, ErrUnsupported.
func List(text string, items []string, options ...Option) (string, error) { func List(text string, items []string, options ...Option) (string, error) {
return list(text, items, applyOptions(options)) return list(text, items, applyOptions(options))
} }
// ListItems displays the list dialog. // ListItems displays the list dialog.
//
// May return: ErrCanceled, ErrExtraButton.
func ListItems(text string, items ...string) (string, error) { func ListItems(text string, items ...string) (string, error) {
return List(text, items) return List(text, items)
} }
@ -17,11 +21,15 @@ func ListItems(text string, items ...string) (string, error) {
// //
// Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton, // Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton,
// Icon, DefaultItems, DisallowEmpty. // Icon, DefaultItems, DisallowEmpty.
//
// May return: ErrCanceled, ErrExtraButton, ErrUnsupported.
func ListMultiple(text string, items []string, options ...Option) ([]string, error) { func ListMultiple(text string, items []string, options ...Option) ([]string, error) {
return listMultiple(text, items, applyOptions(options)) return listMultiple(text, items, applyOptions(options))
} }
// ListMultipleItems displays the list dialog, allowing multiple items to be selected. // ListMultipleItems displays the list dialog, allowing multiple items to be selected.
//
// May return: ErrCanceled, ErrExtraButton.
func ListMultipleItems(text string, items ...string) ([]string, error) { func ListMultipleItems(text string, items ...string) ([]string, error) {
return ListMultiple(text, items) return ListMultiple(text, items)
} }

8
msg.go
View file

@ -4,6 +4,8 @@ package zenity
// //
// Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton, // Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton,
// Icon, NoWrap, Ellipsize, DefaultCancel. // Icon, NoWrap, Ellipsize, DefaultCancel.
//
// May return: ErrCanceled, ErrExtraButton.
func Question(text string, options ...Option) error { func Question(text string, options ...Option) error {
return message(questionKind, text, applyOptions(options)) return message(questionKind, text, applyOptions(options))
} }
@ -12,6 +14,8 @@ func Question(text string, options ...Option) error {
// //
// Valid options: Title, Width, Height, OKLabel, ExtraButton, Icon, // Valid options: Title, Width, Height, OKLabel, ExtraButton, Icon,
// NoWrap, Ellipsize. // NoWrap, Ellipsize.
//
// May return: ErrCanceled, ErrExtraButton.
func Info(text string, options ...Option) error { func Info(text string, options ...Option) error {
return message(infoKind, text, applyOptions(options)) return message(infoKind, text, applyOptions(options))
} }
@ -20,6 +24,8 @@ func Info(text string, options ...Option) error {
// //
// Valid options: Title, Width, Height, OKLabel, ExtraButton, Icon, // Valid options: Title, Width, Height, OKLabel, ExtraButton, Icon,
// NoWrap, Ellipsize. // NoWrap, Ellipsize.
//
// May return: ErrCanceled, ErrExtraButton.
func Warning(text string, options ...Option) error { func Warning(text string, options ...Option) error {
return message(warningKind, text, applyOptions(options)) return message(warningKind, text, applyOptions(options))
} }
@ -28,6 +34,8 @@ func Warning(text string, options ...Option) error {
// //
// Valid options: Title, Width, Height, OKLabel, ExtraButton, Icon, // Valid options: Title, Width, Height, OKLabel, ExtraButton, Icon,
// NoWrap, Ellipsize. // NoWrap, Ellipsize.
//
// May return: ErrCanceled, ErrExtraButton.
func Error(text string, options ...Option) error { func Error(text string, options ...Option) error {
return message(errorKind, text, applyOptions(options)) return message(errorKind, text, applyOptions(options))
} }

View file

@ -4,6 +4,8 @@ package zenity
// //
// Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton, // Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton,
// Icon, MaxValue, Pulsate, NoCancel, TimeRemaining. // Icon, MaxValue, Pulsate, NoCancel, TimeRemaining.
//
// May return: ErrUnsupported
func Progress(options ...Option) (ProgressDialog, error) { func Progress(options ...Option) (ProgressDialog, error) {
return progress(applyOptions(options)) return progress(applyOptions(options))
} }

2
pwd.go
View file

@ -3,6 +3,8 @@ package zenity
// Password displays the password dialog. // Password displays the password dialog.
// //
// Valid options: Title, OKLabel, CancelLabel, ExtraButton, Icon, Username. // Valid options: Title, OKLabel, CancelLabel, ExtraButton, Icon, Username.
//
// May return: ErrCanceled, ErrExtraButton, ErrUnsupported.
func Password(options ...Option) (usr string, pwd string, err error) { func Password(options ...Option) (usr string, pwd string, err error) {
return password(applyOptions(options)) return password(applyOptions(options))
} }