Skip to content

Commit

Permalink
Add IsBoolFlag function
Browse files Browse the repository at this point in the history
  • Loading branch information
dearchap committed Nov 8, 2024
1 parent 0c206f7 commit 886ee6c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions flag_generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ func (f *genericValue) String() string {
return ""
}

func (f *genericValue) IsBoolFlag() bool {
if f.val == nil {
return false
}

Check warning on line 52 in flag_generic.go

View check run for this annotation

Codecov / codecov/patch

flag_generic.go#L51-L52

Added lines #L51 - L52 were not covered by tests
bf, ok := f.val.(boolFlag)
return ok && bf.IsBoolFlag()
}

// Generic looks up the value of a local GenericFlag, returns
// nil if not found
func (cmd *Command) Generic(name string) Value {
Expand Down

0 comments on commit 886ee6c

Please sign in to comment.