From 0e246b3d9186c847e9075e0f087c96939cb37440 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Sat, 26 Mar 2022 00:58:27 +0000 Subject: [PATCH] Documentation, fix #24. --- color.go | 2 ++ entry.go | 2 ++ file.go | 6 ++++++ list.go | 8 ++++++++ msg.go | 8 ++++++++ progress.go | 2 ++ pwd.go | 2 ++ 7 files changed, 30 insertions(+) diff --git a/color.go b/color.go index 781e6a5..b50b2b6 100644 --- a/color.go +++ b/color.go @@ -5,6 +5,8 @@ import "image/color" // SelectColor displays the color selection dialog. // // Valid options: Title, Color, ShowPalette. +// +// May return: ErrCanceled. func SelectColor(options ...Option) (color.Color, error) { return selectColor(applyOptions(options)) } diff --git a/entry.go b/entry.go index ca571d8..011567e 100644 --- a/entry.go +++ b/entry.go @@ -4,6 +4,8 @@ package zenity // // Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton, // Icon, EntryText, HideText. +// +// May return: ErrCanceled, ErrExtraButton. func Entry(text string, options ...Option) (string, error) { return entry(text, applyOptions(options)) } diff --git a/file.go b/file.go index 0ea5dab..5e15d4d 100644 --- a/file.go +++ b/file.go @@ -9,6 +9,8 @@ import ( // SelectFile displays the file selection dialog. // // Valid options: Title, Directory, Filename, ShowHidden, FileFilter(s). +// +// May return: ErrCanceled. func SelectFile(options ...Option) (string, error) { return selectFile(applyOptions(options)) } @@ -16,6 +18,8 @@ func SelectFile(options ...Option) (string, error) { // SelectFileMutiple displays the multiple file selection dialog. // // Valid options: Title, Directory, Filename, ShowHidden, FileFilter(s). +// +// May return: ErrCanceled, ErrUnsupported. func SelectFileMutiple(options ...Option) ([]string, error) { return selectFileMutiple(applyOptions(options)) } @@ -24,6 +28,8 @@ func SelectFileMutiple(options ...Option) ([]string, error) { // // Valid options: Title, Filename, ConfirmOverwrite, ConfirmCreate, ShowHidden, // FileFilter(s). +// +// May return: ErrCanceled. func SelectFileSave(options ...Option) (string, error) { return selectFileSave(applyOptions(options)) } diff --git a/list.go b/list.go index 2c78313..75d7638 100644 --- a/list.go +++ b/list.go @@ -4,11 +4,15 @@ package zenity // // Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton, // Icon, DefaultItems, DisallowEmpty. +// +// May return: ErrCanceled, ErrExtraButton, ErrUnsupported. func List(text string, items []string, options ...Option) (string, error) { return list(text, items, applyOptions(options)) } // ListItems displays the list dialog. +// +// May return: ErrCanceled, ErrExtraButton. func ListItems(text string, items ...string) (string, error) { return List(text, items) } @@ -17,11 +21,15 @@ func ListItems(text string, items ...string) (string, error) { // // Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton, // Icon, DefaultItems, DisallowEmpty. +// +// May return: ErrCanceled, ErrExtraButton, ErrUnsupported. func ListMultiple(text string, items []string, options ...Option) ([]string, error) { return listMultiple(text, items, applyOptions(options)) } // ListMultipleItems displays the list dialog, allowing multiple items to be selected. +// +// May return: ErrCanceled, ErrExtraButton. func ListMultipleItems(text string, items ...string) ([]string, error) { return ListMultiple(text, items) } diff --git a/msg.go b/msg.go index 48e20b1..7b1a830 100644 --- a/msg.go +++ b/msg.go @@ -4,6 +4,8 @@ package zenity // // Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton, // Icon, NoWrap, Ellipsize, DefaultCancel. +// +// May return: ErrCanceled, ErrExtraButton. func Question(text string, options ...Option) error { 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, // NoWrap, Ellipsize. +// +// May return: ErrCanceled, ErrExtraButton. func Info(text string, options ...Option) error { 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, // NoWrap, Ellipsize. +// +// May return: ErrCanceled, ErrExtraButton. func Warning(text string, options ...Option) error { 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, // NoWrap, Ellipsize. +// +// May return: ErrCanceled, ErrExtraButton. func Error(text string, options ...Option) error { return message(errorKind, text, applyOptions(options)) } diff --git a/progress.go b/progress.go index 281f56b..ecb32be 100644 --- a/progress.go +++ b/progress.go @@ -4,6 +4,8 @@ package zenity // // Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton, // Icon, MaxValue, Pulsate, NoCancel, TimeRemaining. +// +// May return: ErrUnsupported func Progress(options ...Option) (ProgressDialog, error) { return progress(applyOptions(options)) } diff --git a/pwd.go b/pwd.go index 5b31480..dd5b066 100644 --- a/pwd.go +++ b/pwd.go @@ -3,6 +3,8 @@ package zenity // Password displays the password dialog. // // Valid options: Title, OKLabel, CancelLabel, ExtraButton, Icon, Username. +// +// May return: ErrCanceled, ErrExtraButton, ErrUnsupported. func Password(options ...Option) (usr string, pwd string, err error) { return password(applyOptions(options)) }