Added an API and test case for number of flags set

This commit is contained in:
Ravi Gadde
2015-02-26 13:51:01 -08:00
parent 50c77ecec0
commit bcec9b08c7
2 changed files with 17 additions and 0 deletions

View File

@@ -106,6 +106,11 @@ func (c *Context) GlobalGeneric(name string) interface{} {
return lookupGeneric(name, c.globalSet)
}
// Returns the number of flags set
func (c *Context) NumFlags() int {
return c.flagSet.NFlag()
}
// Determines if the flag was actually set
func (c *Context) IsSet(name string) bool {
if c.setFlags == nil {