mirror of
https://github.com/thegeeklab/drone-plugin-lib.git
synced 2024-11-05 02:40:40 +00:00
Add Transport to urfave
This commit is contained in:
parent
3a8710d533
commit
2955306f8d
39
pkg/urfave/types.go
Normal file
39
pkg/urfave/types.go
Normal 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),
|
||||
}
|
||||
}
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user