Merge branch 'master' into master

This commit is contained in:
Ben Zvan 2019-06-14 10:14:07 -05:00 committed by GitHub
commit 23042d3707
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -670,7 +670,7 @@ func main() {
```
Note that default values set from file (e.g. `FilePath`) take precedence over
default values set from the enviornment (e.g. `EnvVar`).
default values set from the environment (e.g. `EnvVar`).
#### Values from alternate input sources (YAML, TOML, and others)

7
app.go
View File

@ -495,11 +495,12 @@ func (a Author) String() string {
// it's an ActionFunc or a func with the legacy signature for Action, the func
// is run!
func HandleAction(action interface{}, context *Context) (err error) {
if a, ok := action.(ActionFunc); ok {
switch a := action.(type) {
case ActionFunc:
return a(context)
} else if a, ok := action.(func(*Context) error); ok {
case func(*Context) error:
return a(context)
} else if a, ok := action.(func(*Context)); ok { // deprecated function signature
case func(*Context): // deprecated function signature
a(context)
return nil
}