authors

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvKeyCoauthorsPath = "GITMOB_COAUTHORS_PATH"
)

Variables

View Source
var (
	CoAuthorsFilePath string
)

Functions

func EnsureCoauthorsFileExists

func EnsureCoauthorsFileExists(path string) error

func WriteCoauthorsContent added in v0.7.0

func WriteCoauthorsContent(cc CoAuthorsFileContent) error

func WriteCoauthorsContentToFilePath added in v0.7.0

func WriteCoauthorsContentToFilePath(path string, cc CoAuthorsFileContent) error

Types

type Author

type Author struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

func MustParseOne

func MustParseOne(s string) Author

MustParseOne parses an author string into an Author and panics if parsing fails

func ParseOne

func ParseOne(s string) (Author, error)

ParseOne parses an author string into an Author

func (Author) CoauthorTag

func (a Author) CoauthorTag() string

func (Author) CoauthorTagBytes

func (a Author) CoauthorTagBytes() []byte

func (Author) InitialsFromName

func (a Author) InitialsFromName() string

func (Author) LooksAnonymous added in v0.10.0

func (a Author) LooksAnonymous() bool

func (Author) String

func (a Author) String() string

type AuthorList added in v0.6.1

type AuthorList struct {
	Members []*Author `json:"members"`
}

AuthorList is a helper type to support string format when printing a list of authors

func (AuthorList) SortBy added in v0.6.1

func (m AuthorList) SortBy(less func(left, right *Author) bool)

func (AuthorList) String added in v0.6.1

func (m AuthorList) String() string

String implements Stringer to format our list output as a string

func (AuthorList) WriteToTable added in v0.6.1

func (m AuthorList) WriteToTable(table *tablewriter.Table)

type AuthorWithInitials

type AuthorWithInitials struct {
	Initials string `json:"initials"`
	Name     string `json:"name"`
	Email    string `json:"email"`
}

type CoAuthorsFileContent

type CoAuthorsFileContent struct {
	CoAuthorsByInitial map[string]Author `json:"coauthors"`
}

func ReadCoAuthorsContent

func ReadCoAuthorsContent() (CoAuthorsFileContent, error)

func ReadCoAuthorsContentFromBytes

func ReadCoAuthorsContentFromBytes(b []byte) (CoAuthorsFileContent, error)

func ReadCoAuthorsContentFromFilePath added in v0.6.1

func ReadCoAuthorsContentFromFilePath(filePath string) (CoAuthorsFileContent, error)

func (CoAuthorsFileContent) FindAndFormatAsList

func (f CoAuthorsFileContent) FindAndFormatAsList(initials ...string) []string

func (CoAuthorsFileContent) FindInitialsFromCoAuthorStrings

func (f CoAuthorsFileContent) FindInitialsFromCoAuthorStrings(ss ...string) []string

func (CoAuthorsFileContent) LookupByEmail added in v0.10.0

func (f CoAuthorsFileContent) LookupByEmail(email ...string) []Author

func (CoAuthorsFileContent) LookupByInitials

func (f CoAuthorsFileContent) LookupByInitials(initials ...string) []Author

type DuplicateInitialsError added in v0.8.0

type DuplicateInitialsError struct {
	DuplicateAuthorsByInitial map[string][]Author
	Message                   string
}

func NewDuplicateInitialsError added in v0.8.0

func NewDuplicateInitialsError(duplicates map[string][]Author) DuplicateInitialsError

func (DuplicateInitialsError) Error added in v0.8.0

func (e DuplicateInitialsError) Error() string

Jump to

Keyboard shortcuts

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