update mitchellh/cli
This commit is contained in:
parent
cc5e480378
commit
ca4abd0654
|
@ -646,9 +646,29 @@ func (c *CLI) processArgs() {
|
|||
if c.subcommand == "" && arg != "" && arg[0] != '-' {
|
||||
c.subcommand = arg
|
||||
if c.commandNested {
|
||||
// If the command has a space in it, then it is invalid.
|
||||
// Set a blank command so that it fails.
|
||||
if strings.ContainsRune(arg, ' ') {
|
||||
c.subcommand = ""
|
||||
return
|
||||
}
|
||||
|
||||
// Determine the argument we look to to end subcommands.
|
||||
// We look at all arguments until one has a space. This
|
||||
// disallows commands like: ./cli foo "bar baz". An argument
|
||||
// with a space is always an argument.
|
||||
j := 0
|
||||
for k, v := range c.Args[i:] {
|
||||
if strings.ContainsRune(v, ' ') {
|
||||
break
|
||||
}
|
||||
|
||||
j = i + k + 1
|
||||
}
|
||||
|
||||
// Nested CLI, the subcommand is actually the entire
|
||||
// arg list up to a flag that is still a valid subcommand.
|
||||
searchKey := strings.Join(c.Args[i:], " ")
|
||||
searchKey := strings.Join(c.Args[i:j], " ")
|
||||
k, _, ok := c.commandTree.LongestPrefix(searchKey)
|
||||
if ok {
|
||||
// k could be a prefix that doesn't contain the full
|
||||
|
|
|
@ -1904,10 +1904,12 @@
|
|||
"revisionTime": "2017-01-23T01:43:24Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "UIqCj7qI0hhIMpAhS9YYqs2jD48=",
|
||||
"checksumSHA1": "H3IQOMnazofqqNSyfY/GIx1T3mU=",
|
||||
"path": "github.com/mitchellh/cli",
|
||||
"revision": "65fcae5817c8600da98ada9d7edf26dd1a84837b",
|
||||
"revisionTime": "2017-09-08T18:10:43Z"
|
||||
"revision": "33edc47170b5df54d2588696d590c5e20ee583fe",
|
||||
"revisionTime": "2017-11-29T19:36:17Z",
|
||||
"version": "master",
|
||||
"versionExact": "master"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "ttEN1Aupb7xpPMkQLqb3tzLFdXs=",
|
||||
|
|
Loading…
Reference in New Issue