Help us shape the future of Go! Take the 2026 Go Developer Survey

urfave

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: Apache-2.0 Imports: 9 Imported by: 31

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/urfave"
	"github.com/urfave/cli/v2"
)

func main() {
	app := cli.NewApp()
	app.Name = "plugin name"
	app.Action = run
	app.Flags = []cli.Flag{
		// All my plugin flags
	}

	app.Flags = append(
		app.Flags,
		urfave.Flags()...,
	)
}

func run(ctx *cli.Context) error {
	pipeline := urfave.FromContext(ctx)
	...
	return nil
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flags

func Flags() []cli.Flag

Flags has the cli.Flags for the Drone plugin.

func LoggingFromContext

func LoggingFromContext(ctx *cli.Context)

LoggingFromContext sets the logrus logging level.

func NetworkFromContext

func NetworkFromContext(c *cli.Context) drone.Network

NetworkFromContext creates a drone.Network from the cli.Context.

func PipelineFromContext

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

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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