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.
//
// Valid options: Title, Color, ShowPalette.
//
// May return: ErrCanceled.
func SelectColor(options ...Option) (color.Color, error) {
return selectColor(applyOptions(options))
}

View File

@ -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))
}

View File

@ -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))
}

View File

@ -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)
}

8
msg.go
View File

@ -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))
}

View File

@ -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))
}

2
pwd.go
View File

@ -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))
}