From 9f9a48794aeb8801fb3ac3ca7a6f4b2e84c0b241 Mon Sep 17 00:00:00 2001 From: Cyril David Date: Fri, 19 Mar 2021 22:28:44 -0700 Subject: [PATCH] Add docs for flags.Required() --- internal/cli/flags.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/cli/flags.go b/internal/cli/flags.go index cd06c4358..22474c86e 100644 --- a/internal/cli/flags.go +++ b/internal/cli/flags.go @@ -15,6 +15,9 @@ type Flag struct { IsRequired bool } +// Required clones an existing flag and assigns `IsRequired` to true. This is +// useful when there are flags with several different use cases -- e.g. create +// requiring the flag, but update not requiring it. func (f *Flag) Required() *Flag { clone := *f clone.IsRequired = true