urfave

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package urfave provides helpers for interacting with the `urfave/cli` package when creating plugins for use by the Drone CI/CD service.

Drone communicates to plugins by passing in environment variables that have information on the currently executing build. The `urfave/cli` package can read these environment variables and extract them into structs.

    import(
        "github.com/drone-plugins/drone-plugin-lib/pkg/urfave"
        "github.com/urfave/cli"
	   )

    func main() {
        app := cli.New()
        app.Name = "my awesome Drone plugin"
        app.Run = run
        app.Flags = []cli.Flags{
            // All my plugin flags
        }
        app.Flags = append(
            app.Flags,
            urfave.Flags()...,
        )
    }

    func run(ctx *cli.Context) {
        	pipeline := urfave.PipelineFromContext(ctx)
         ....
    }

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flags

func Flags() []cli.Flag

Flags for a urfave cli Drone plugin

func LoggingFromContext

func LoggingFromContext(ctx *cli.Context)

LoggingFromContext sets the logrus logging level.

func PipelineFromContext

func PipelineFromContext(ctx *cli.Context) plugin.Pipeline

PipelineFromContext creates a plugin.Pipeline from the cli.Context.

Types

type Network

type Network struct {
	// Context for making network requests.
	//
	// If `trace` logging is requested the context will use `httptrace` to
	// capture all network requests.
	Context context.Context

	// Client for making network requests.
	Client *http.Client

	/// Whether SSL verification is skipped
	SkipVerify bool
}

Network contains options for connecting to the network.

func NetworkFromContext

func NetworkFromContext(ctx *cli.Context) Network

NetworkFromContext creates a Transport from the cli.Context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL