Add Transport to urfave

This commit is contained in:
Don 2019-09-09 18:04:09 -07:00
parent 3a8710d533
commit 2955306f8d
2 changed files with 40 additions and 1 deletions

39
pkg/urfave/types.go Normal file
View File

@ -0,0 +1,39 @@
// Copyright (c) 2019, the Drone Plugins project authors.
// Please see the AUTHORS file for details. All rights reserved.
// Use of this source code is governed by an Apache 2.0 license that can be
// found in the LICENSE file.
package urfave
import "github.com/urfave/cli"
//---------------------------------------------------------------------
// Transport Flags
//---------------------------------------------------------------------
// Transport contains options for the underlying http client.
type Transport struct {
// SSLVerify certificate information.
SSLVerify bool
}
const transportSSLVerifyFlag = "transport.ssl-verify"
// TransportFlags has the cli.Flags for the Transport.
func TransportFlags() []cli.Flag {
return []cli.Flag{
cli.BoolFlag{
Name: transportSSLVerifyFlag,
Usage: "transport ssl verify",
EnvVar: "PLUGIN_SSL_VERIFY",
Hidden: true,
},
}
}
// TransportFromContext creates a Transport from the cli.Context.
func TransportFromContext(ctx cli.Context) Transport {
return Transport{
SSLVerify: ctx.Bool(transportSSLVerifyFlag),
}
}

View File

@ -648,7 +648,7 @@ func SemVerFlags() []cli.Flag {
}
}
// SemVerFromContext creates a plugin.Step from the cli.SemVer.
// SemVerFromContext creates a plugin.Step from the cli.Context.
func SemVerFromContext(ctx *cli.Context) plugin.SemVer {
return plugin.SemVer{
Build: ctx.String(SemVerBuildFlag),