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:
parent
4ed49e73fb
commit
f9e91156d0
172 changed files with 6865 additions and 1599 deletions
18
vendor/gopkg.in/alecthomas/kingpin.v2/parser.go
generated
vendored
18
vendor/gopkg.in/alecthomas/kingpin.v2/parser.go
generated
vendored
|
|
@ -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())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue