Merge remote-tracking branch 'origin/master' into completion_fix

This commit is contained in:
Joshua Rubin
2016-11-18 09:28:39 -07:00
14 changed files with 607 additions and 76 deletions

View File

@@ -3,9 +3,9 @@ package cli
import (
"errors"
"flag"
"os"
"reflect"
"strings"
"syscall"
)
// Context is a type that is passed through to
@@ -98,7 +98,7 @@ func (c *Context) IsSet(name string) bool {
eachName(envVarValue.String(), func(envVar string) {
envVar = strings.TrimSpace(envVar)
if envVal := os.Getenv(envVar); envVal != "" {
if _, ok := syscall.Getenv(envVar); ok {
c.setFlags[name] = true
return
}
@@ -154,6 +154,11 @@ func (c *Context) Parent() *Context {
return c.parentContext
}
// value returns the value of the flag coressponding to `name`
func (c *Context) value(name string) interface{} {
return c.flagSet.Lookup(name).Value.(flag.Getter).Get()
}
// Args contains apps console arguments
type Args []string