|
|
@ -3,6 +3,7 @@ package cli
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
"flag"
|
|
|
|
"flag"
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -46,10 +47,11 @@ func (cCtx *Context) NumFlags() int {
|
|
|
|
|
|
|
|
|
|
|
|
// Set sets a context flag to a value.
|
|
|
|
// Set sets a context flag to a value.
|
|
|
|
func (cCtx *Context) Set(name, value string) error {
|
|
|
|
func (cCtx *Context) Set(name, value string) error {
|
|
|
|
if cCtx.flagSet.Lookup(name) == nil {
|
|
|
|
if fs := cCtx.lookupFlagSet(name); fs != nil {
|
|
|
|
cCtx.onInvalidFlag(name)
|
|
|
|
return fs.Set(name, value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return cCtx.flagSet.Set(name, value)
|
|
|
|
|
|
|
|
|
|
|
|
return fmt.Errorf("no such flag -%s", name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// IsSet determines if the flag was actually set
|
|
|
|
// IsSet determines if the flag was actually set
|
|
|
|