collect

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2015 License: MIT Imports: 9 Imported by: 0

README

go-collect

Build Status GoDoc

go-collect fetches key=value content from different sources and from command line flags and merges everything into data objects.

Available sources:

Usage

go get http://gopkg.in/mattes/go-collect.v0

Tools built with go-collect

  • fugu - Swiss Army knife for Docker

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownScheme = errors.New("source: scheme is unknown")
)

Functions

func ParseLabel

func ParseLabel(args *[]string) (label string)

func RegisterSource

func RegisterSource(s Source)

func SourceExampleUrls

func SourceExampleUrls() []string

func Sources

func Sources() map[string]Source

Types

type Collector

type Collector struct {
	// contains filtered or unexported fields
}

func New

func New() *Collector

func (*Collector) AddFlags

func (c *Collector) AddFlags(f ...*flags.Flags)

func (*Collector) AddSource

func (c *Collector) AddSource(s ...string)

func (*Collector) GetDefaultSource

func (c *Collector) GetDefaultSource() string

func (*Collector) Label

func (c *Collector) Label() string

func (*Collector) Labels

func (c *Collector) Labels() []string

func (*Collector) Parse

func (c *Collector) Parse(args []string, f ...*flags.Flags) (p *data.Data, remainingArgs []string, err error)

func (*Collector) PrintUsage

func (c *Collector) PrintUsage()

func (*Collector) SetDefaultSource

func (c *Collector) SetDefaultSource(s string)

func (*Collector) Sources

func (c *Collector) Sources() []string

type Source

type Source interface {

	// Return the source scheme, like file or etcd
	Scheme() string

	// Return example url with scheme, ie file://config.yml
	ExampleUrl() string

	// Gets called after the flags are parsed
	// Read or load any additional sources here
	// Return data for label
	Load(label string, u *url.URL) (*data.Data, error)

	// Returns all labels
	Labels() []string
}

func GetSource

func GetSource(scheme string) Source

Directories

Path Synopsis
source

Jump to

Keyboard shortcuts

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