parser

package
v0.0.0-...-6a354e9 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package parser parses fpm help output into a usable object model.

Index

Constants

View Source
const PluginPrefix = "PLUGIN_"

PluginPrefix is the prefix drone will add to all options passed into the plugin as environment variables.

Variables

This section is empty.

Functions

This section is empty.

Types

type ParsedFlag

type ParsedFlag struct {
	// Option is the command line option for fpm.
	Option string

	// EnvVar is the environment variable that drone will use to inject the variable into the container.
	EnvVar string

	// HasInput is used to determine if the flag contains input or not.
	HasInput bool
}

ParsedFlag contains a flag parsed from the fpm help output.

type ParsedOptionLine

type ParsedOptionLine struct {
	// Options is a comma separated list of potential options for the flag in question.
	Options string

	// Docs is the doc string for the command line flag.
	Docs string

	// HasInput is used to determine if the flag contains input or not.
	HasInput bool
}

ParsedOptionLine is a structured representation of an option line for fpm's help message.

type Parser

type Parser struct {
	// Lines is a slice of strings containing the fpm help output.
	Lines []string
}

Parser is a struct containing the lines to parse.

func NewInitialisedParser

func NewInitialisedParser() (*Parser, error)

NewInitialisedParser creates a new parser populated with output from fpm -h.

func (*Parser) Parse

func (p *Parser) Parse() ([]ParsedFlag, error)

Parse will return the output of fpm -h as a slice of structured flag objects.

Jump to

Keyboard shortcuts

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