Skip to content

Commit

Permalink
Add docs for flags.Required()
Browse files Browse the repository at this point in the history
  • Loading branch information
cyx committed Mar 20, 2021
1 parent 31dd394 commit fa79f50
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/cli/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fa79f50

Please sign in to comment.