summaryrefslogtreecommitdiff
path: root/vendor/github.com/urfave/cli/context.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2017-12-04 10:24:08 -0600
committerAtomic Bot <atomic-devel@projectatomic.io>2017-12-04 20:03:16 +0000
commit265efcb9f88a78ee52eb5644d4db86e49788991f (patch)
treecf0d95609547408a30bcad558829701b344fc787 /vendor/github.com/urfave/cli/context.go
parent750fc239b5da8e3f2792ae33f46a671ddf4622e3 (diff)
downloadpodman-265efcb9f88a78ee52eb5644d4db86e49788991f.tar.gz
podman-265efcb9f88a78ee52eb5644d4db86e49788991f.tar.bz2
podman-265efcb9f88a78ee52eb5644d4db86e49788991f.zip
Vendor in latest urfave/cli
The latest urfave/cli has the ability for us to use short options when it is a bool. Signed-off-by: baude <bbaude@redhat.com> Closes: #100 Approved by: rhatdan
Diffstat (limited to 'vendor/github.com/urfave/cli/context.go')
-rw-r--r--vendor/github.com/urfave/cli/context.go31
1 files changed, 20 insertions, 11 deletions
diff --git a/vendor/github.com/urfave/cli/context.go b/vendor/github.com/urfave/cli/context.go
index db94191e2..552ee7405 100644
--- a/vendor/github.com/urfave/cli/context.go
+++ b/vendor/github.com/urfave/cli/context.go
@@ -3,6 +3,7 @@ package cli
import (
"errors"
"flag"
+ "os"
"reflect"
"strings"
"syscall"
@@ -73,7 +74,7 @@ func (c *Context) IsSet(name string) bool {
// change in version 2 to add `IsSet` to the Flag interface to push the
// responsibility closer to where the information required to determine
// whether a flag is set by non-standard means such as environment
- // variables is avaliable.
+ // variables is available.
//
// See https://github.com/urfave/cli/issues/294 for additional discussion
flags := c.Command.Flags
@@ -93,18 +94,26 @@ func (c *Context) IsSet(name string) bool {
val = val.Elem()
}
- envVarValue := val.FieldByName("EnvVar")
- if !envVarValue.IsValid() {
- return
+ filePathValue := val.FieldByName("FilePath")
+ if filePathValue.IsValid() {
+ eachName(filePathValue.String(), func(filePath string) {
+ if _, err := os.Stat(filePath); err == nil {
+ c.setFlags[name] = true
+ return
+ }
+ })
}
- eachName(envVarValue.String(), func(envVar string) {
- envVar = strings.TrimSpace(envVar)
- if _, ok := syscall.Getenv(envVar); ok {
- c.setFlags[name] = true
- return
- }
- })
+ envVarValue := val.FieldByName("EnvVar")
+ if envVarValue.IsValid() {
+ eachName(envVarValue.String(), func(envVar string) {
+ envVar = strings.TrimSpace(envVar)
+ if _, ok := syscall.Getenv(envVar); ok {
+ c.setFlags[name] = true
+ return
+ }
+ })
+ }
})
}
}