foreachref

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

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

Format supports specifying and parsing an output format for 'git for-each-ref'. See See git-for-each-ref(1) for available fields.

func NewFormat

func NewFormat(fieldNames ...string) Format

NewFormat creates a forEachRefFormat using the specified fieldNames. See git-for-each-ref(1) for available fields.

func (Format) Flag

func (f Format) Flag() string

Flag returns a for-each-ref --format flag value that captures the fieldNames.

func (Format) Parser

func (f Format) Parser(r io.Reader) *Parser

Parser returns a Parser capable of parsing 'git for-each-ref' output produced with this Format.

type Parser

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

Parser parses 'git for-each-ref' output according to a given output Format.

func NewParser

func NewParser(r io.Reader, format Format) *Parser

NewParser creates a 'git for-each-ref' output parser that will parse all references in the provided Reader. The references in the output are assumed to follow the specified Format.

func (*Parser) Err

func (p *Parser) Err() error

Err returns the latest encountered parsing error.

func (*Parser) Next

func (p *Parser) Next() map[string]string

Next returns the next reference as a collection of key-value pairs. nil denotes EOF but is also returned on errors. The Err method should always be consulted after Next returning nil.

It could, for example return something like:

{ "objecttype": "tag", "refname:short": "v1.16.4", "object": "f460b7543ed500e49c133c2cd85c8c55ee9dbe27" }

Jump to

Keyboard shortcuts

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