pmbodyparser

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind string
const (
	Blocks      Kind = "blocks"
	DependsOn   Kind = "depends-on"
	Fixes       Kind = "fixes"
	Closes      Kind = "closes"
	Addresses   Kind = "addresses"
	RelatedWith Kind = "related-with"
	PartOf      Kind = "part-of"
	ParentOf    Kind = "parent-of"
)

type Relationship

type Relationship struct {
	Kind   Kind
	Target multipmuri.Entity
}

func (Relationship) String

func (r Relationship) String() string

type Relationships

type Relationships []Relationship

func ParseString

func ParseString(body string) (Relationships, []error)
Example
rels, errs := ParseString("Depends on github.com/moul/depviz#1")
if len(errs) > 0 {
	panic(errs)
}
for _, rel := range rels {
	fmt.Println(rel)
}
Output:

depends-on https://github.com/moul/depviz/issues/1

func RelParseString

func RelParseString(context multipmuri.Entity, body string) (Relationships, []error)
Example
body := `
This PR fixes a lot of things and implement plenty new features.

Addresses #42
Depends on: github.com/moul/depviz#42
Blocks #45
Block: #46
fixes: #58
FIX github.com/moul/depviz#1337

Signed-off-by: Super Developer <super.dev@gmail.com>
`
relationships, errs := RelParseString(
	multipmuri.NewGitHubIssue("github.com", "moul", "depviz", "1"),
	body,
)
if len(errs) > 0 {
	panic(errs)
}
for _, relationship := range relationships {
	fmt.Println(relationship)
}
Output:

addresses https://github.com/moul/depviz/issues/42
blocks https://github.com/moul/depviz/issues/45
blocks https://github.com/moul/depviz/issues/46
depends-on https://github.com/moul/depviz/issues/42
fixes https://github.com/moul/depviz/issues/1337
fixes https://github.com/moul/depviz/issues/58

func (Relationships) Len added in v1.2.0

func (r Relationships) Len() int

func (Relationships) Less added in v1.2.0

func (r Relationships) Less(i, j int) bool

func (Relationships) Swap added in v1.2.0

func (r Relationships) Swap(i, j int)

Jump to

Keyboard shortcuts

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