Documentation.

This commit is contained in:
Nuno Cruces 2022-05-02 11:22:53 +01:00
parent 6d0d4b9b79
commit 85b815da3b
5 changed files with 10 additions and 10 deletions

View File

@ -9,7 +9,7 @@ import (
// Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton, // Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton,
// Icon, DefaultDate. // Icon, DefaultDate.
// //
// May return: ErrCanceled. // May return: ErrCanceled, ErrExtraButton.
func Calendar(text string, options ...Option) (time.Time, error) { func Calendar(text string, options ...Option) (time.Time, error) {
return calendar(text, applyOptions(options)) return calendar(text, applyOptions(options))
} }

View File

@ -39,14 +39,14 @@ func Directory() Option {
return funcOption(func(o *options) { o.directory = true }) return funcOption(func(o *options) { o.directory = true })
} }
// ConfirmOverwrite returns an Option to confirm file selection if filename // ConfirmOverwrite returns an Option to confirm file selection if the file
// already exists. // already exists.
func ConfirmOverwrite() Option { func ConfirmOverwrite() Option {
return funcOption(func(o *options) { o.confirmOverwrite = true }) return funcOption(func(o *options) { o.confirmOverwrite = true })
} }
// ConfirmCreate returns an Option to confirm file selection if filename does // ConfirmCreate returns an Option to confirm file selection if the file
// not yet exist (Windows only). // does not yet exist (Windows only).
func ConfirmCreate() Option { func ConfirmCreate() Option {
return funcOption(func(o *options) { o.confirmCreate = true }) return funcOption(func(o *options) { o.confirmCreate = true })
} }

View File

@ -12,7 +12,7 @@ func List(text string, items []string, options ...Option) (string, error) {
// ListItems displays the list dialog. // ListItems displays the list dialog.
// //
// May return: ErrCanceled, ErrExtraButton. // May return: ErrCanceled.
func ListItems(text string, items ...string) (string, error) { func ListItems(text string, items ...string) (string, error) {
return List(text, items) return List(text, items)
} }
@ -29,7 +29,7 @@ func ListMultiple(text string, items []string, options ...Option) ([]string, err
// 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. // May return: ErrCanceled.
func ListMultipleItems(text string, items ...string) ([]string, error) { func ListMultipleItems(text string, items ...string) ([]string, error) {
return ListMultiple(text, items) return ListMultiple(text, items)
} }

View File

@ -5,7 +5,7 @@ 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 // May return: ErrUnsupported.
func Progress(options ...Option) (ProgressDialog, error) { func Progress(options ...Option) (ProgressDialog, error) {
return progress(applyOptions(options)) return progress(applyOptions(options))
} }
@ -27,7 +27,7 @@ type ProgressDialog interface {
// Close closes the dialog. // Close closes the dialog.
Close() error Close() error
// Done returns a channel that's closed when the dialog is closed. // Done returns a channel that is closed when the dialog is closed.
Done() <-chan struct{} Done() <-chan struct{}
} }

View File

@ -124,7 +124,7 @@ func CancelLabel(cancel string) Option {
return funcOption(func(o *options) { o.cancelLabel = &cancel }) return funcOption(func(o *options) { o.cancelLabel = &cancel })
} }
// ExtraButton returns an Option to add an extra button. // ExtraButton returns an Option to add one extra button.
func ExtraButton(extra string) Option { func ExtraButton(extra string) Option {
return funcOption(func(o *options) { o.extraButton = &extra }) return funcOption(func(o *options) { o.extraButton = &extra })
} }
@ -150,7 +150,7 @@ func Icon(icon DialogIcon) Option { return icon }
// Context returns an Option to set a Context that can dismiss the dialog. // Context returns an Option to set a Context that can dismiss the dialog.
// //
// Dialogs dismissed by the Context return Context.Err. // Dialogs dismissed by ctx return ctx.Err().
func Context(ctx context.Context) Option { func Context(ctx context.Context) Option {
return funcOption(func(o *options) { o.ctx = ctx }) return funcOption(func(o *options) { o.ctx = ctx })
} }