Update vendoring (#801)

* Update vendor github.com/godbus/dbus@v4.1.0

* Update vendor github.com/golang/protobuf/proto

* Update vendor github.com/mdlayher/netlink/...

* Update vendor github.com/prometheus/client_golang/prometheus/...

* Update vendor github.com/prometheus/client_model/go

* Update vendor github.com/prometheus/common/...

* Update vendor github.com/prometheus/procfs/...

* Update vendor github.com/sirupsen/logrus@v1.0.4

* Update vendor golang.org/x/...

* Update vendor gopkg.in/alecthomas/kingpin.v2

* Remove obsolete vendor github.com/mdlayher/netlink/genetlink
This commit is contained in:
Ben Kochie 2018-01-25 18:20:39 +01:00 committed by GitHub
commit f9e91156d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
172 changed files with 6865 additions and 1599 deletions

View file

@ -222,7 +222,7 @@ Args:
<ip> IP address to ping.
[<count>] Number of packets to send
$ ping 1.2.3.4 5
Would ping: 1.2.3.4 with timeout 5s and count 0
Would ping: 1.2.3.4 with timeout 5s and count 5
```
From the following source:
@ -461,7 +461,7 @@ Here are some examples of flags with various permutations:
--name=NAME // Flag(...).String()
--name="Harry" // Flag(...).Default("Harry").String()
--name=FULL-NAME // flag(...).PlaceHolder("FULL-NAME").Default("Harry").String()
--name=FULL-NAME // Flag(...).PlaceHolder("FULL-NAME").Default("Harry").String()
### Consuming all remaining arguments

View file

@ -402,6 +402,9 @@ func (a *Application) setDefaults(context *ParseContext) error {
flagElements := map[string]*ParseElement{}
for _, element := range context.Elements {
if flag, ok := element.Clause.(*FlagClause); ok {
if flag.name == "help" {
return nil
}
flagElements[flag.name] = element
}
}

View file

@ -153,6 +153,10 @@ func (p *ParseContext) EOL() bool {
return p.Peek().Type == TokenEOL
}
func (p *ParseContext) Error() bool {
return p.Peek().Type == TokenError
}
// Next token in the parse context.
func (p *ParseContext) Next() *Token {
if len(p.peek) > 0 {
@ -266,9 +270,12 @@ func (p *ParseContext) matchedCmd(cmd *CmdClause) {
// Expand arguments from a file. Lines starting with # will be treated as comments.
func ExpandArgsFromFile(filename string) (out []string, err error) {
if filename == "" {
return nil, fmt.Errorf("expected @ file to expand arguments from")
}
r, err := os.Open(filename)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to open arguments file %q: %s", filename, err)
}
defer r.Close()
scanner := bufio.NewScanner(r)
@ -280,6 +287,9 @@ func ExpandArgsFromFile(filename string) (out []string, err error) {
out = append(out, line)
}
err = scanner.Err()
if err != nil {
return nil, fmt.Errorf("failed to read arguments from %q: %s", filename, err)
}
return
}
@ -291,7 +301,7 @@ func parse(context *ParseContext, app *Application) (err error) {
ignoreDefault := context.ignoreDefault
loop:
for !context.EOL() {
for !context.EOL() && !context.Error() {
token := context.Peek()
switch token.Type {
@ -365,6 +375,10 @@ loop:
}
}
if context.Error() {
return fmt.Errorf("%s", context.Peek().Value)
}
if !context.EOL() {
return fmt.Errorf("unexpected %s", context.Peek())
}