From c2570188f3ae8a77e01e790790bdcd688aec51f4 Mon Sep 17 00:00:00 2001 From: Kenneth Shaw Date: Sun, 24 Nov 2024 09:23:28 +0700 Subject: [PATCH] Expand documentation Option --- opts.go | 20 +++++++++++++++++++- uuid/uuid_test.go | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/opts.go b/opts.go index 4e2185f..2743491 100644 --- a/opts.go +++ b/opts.go @@ -363,7 +363,25 @@ func Relative(dir string) Option { } */ -// Option is a option. +// Option is the interface for options that can be passed when creating a +// [RunContext], [Command], or [Flag]. +// +// The [Option] type is aliased as [RunOption], [CommandOption], +// [CommandFlagOption], and [FlagOption] and provided for ease-of-use, +// readibility, and categorization within documentation. +// +// A [RunOption] can be applied to a [RunContext] and passed to [Run]. +// +// A [CommandOption] can be applied to a [Command] and passed to [NewCommand]. +// +// A [CommandFlagOption] can be applied to either a [Command] or [Flag], and +// can be passed to [NewCommand] and [NewFlag]. +// +// A [FlagOption] can be applied to a [Flag] and passed to [NewFlag]. +// +// Additionally, a [OnErr] can be used as a [CommandOption] or in calls to +// [NewCommand], and a [Type] can be used as a [FlagOption] in calls to +// [NewFlag]. type Option interface { apply(any) error } diff --git a/uuid/uuid_test.go b/uuid/uuid_test.go index 475761b..4f1e869 100644 --- a/uuid/uuid_test.go +++ b/uuid/uuid_test.go @@ -38,6 +38,7 @@ func TestUUID(t *testing.T) { func uuidTests() []string { return []string{ "", + "00000000-0000-0000-0000-000000000000", "f47ac10b-58cc-0372-8567-0e02b2c3d479", "f47ac10b-58cc-1372-8567-0e02b2c3d479", "f47ac10b-58cc-2372-8567-0e02b2c3d479",