cmd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RequiredType error msg of missing type
	RequiredType = "commit type is required"
	// RequiredDesc error msg of missing description
	RequiredDesc = "commit description is required"
	// InvalidType error msg of invalid type
	InvalidType = "commit type is invalid"
	// InvalidScope error msg of invalid scope
	InvalidScope = "commit scope is invalid"
	// InvalidDesc error msg of invalid description
	InvalidDesc = "commit description is invalid"
	// InvalidBrkChnFTSep error msg of invalid breaking change footer separator
	InvalidBrkChnFTSep = "breaking change footer separator is invalid"
	// RequiredBrkChnFTDesc error msg of missing breaking footer description
	RequiredBrkChnFTDesc = "breaking change footer description is required"

	// InvalidFooter error msg of invalid footer
	InvalidFooter = "commit footer is invalid"
	// InvalidFooterToken error msg of invalid footer
	InvalidFooterToken = "commit footer token is invalid"
	// FTokenBrkChange special footer token
	FTokenBrkChange = "BREAKING CHANGE"
	// FTokenBrkChangeAlias FTokenBrkChange alias
	FTokenBrkChangeAlias = "BREAKING-CHANGE"
	// FSepColonSpace footer separator
	FSepColonSpace = ": "
	// FSepSpaceSharp footer separator
	FSepSpaceSharp = " #"
)
View Source
const GitExec = "git"

GitExec git executable name

Variables

This section is empty.

Functions

func ContainsNewline

func ContainsNewline(s string) bool

ContainsNewline check if string contains newline chars

func ContainsWhiteSpace

func ContainsWhiteSpace(s string) bool

ContainsWhiteSpace check if string contains whitesapces

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GitCommit

func GitCommit(msg string)

GitCommit exec `git commit -m`

func IsBrkChnFooter

func IsBrkChnFooter(token string) bool

IsBrkChnFooter check if token is breaking change footer token

func ParseFooter

func ParseFooter(f string) (token, sep, val string)

ParseFooter return components of a commit msg footer if seperable by ": " or " #" @param f footer without no newlines @return token "" if separated wrongly @return sep "" if separated wrongly @return val "" if separated wrongly

Types

type CommitMsg

type CommitMsg struct {
	Type         string   // required, preset or config values only
	Scope        string   // optional
	HasBrkChange bool     // optional, default false
	Description  string   // required, no line break
	Body         string   // optional, allow line breaks
	Footers      []string // optional, allow multiple lines
}

CommitMsg properties

func (CommitMsg) ToString

func (cm CommitMsg) ToString(fp string) string

ToString format commit msg as conventional commits spec v1.0.0

func (CommitMsg) Validate

func (cm CommitMsg) Validate() (bool, string)

Validate commit msg elements @return valid {bool} @return msg {string} error msg

Jump to

Keyboard shortcuts

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