commit

package
v0.108.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyCommitMessage is returned when the commit message is empty
	ErrEmptyCommitMessage error = errors.New("error: empty commit message")
)

Functions

This section is empty.

Types

type Commit

type Commit struct {
	//
	//  type defines the type of commit message such as "chore", "fix", "feat", etc. as
	//  defined by the conventional commit specification. More information on
	//  -> https://www.conventionalcommits.org/en/
	//
	//  default:
	//    * chore
	//
	Type string `yaml:",omitempty"`
	//
	//  scope defines the scope of the commit message as defined by the
	//  conventional commit specification. More information on
	//  -> https://www.conventionalcommits.org/en/
	//
	//  default:
	//    none
	//
	Scope string `yaml:",omitempty"`
	//
	//  footers defines the footer of the commit message as defined by the
	//  conventional commit specification. More information on
	//  -> https://www.conventionalcommits.org/en/
	//
	//  default:
	//    none
	//
	Footers string `yaml:",omitempty"`
	//
	//  title" defines the title of the commit message as defined by the
	//  conventional commit specification. More information on
	//  -> https://www.conventionalcommits.org/en/
	//
	//  default:
	//    default is set to the target name or the target short description
	//    if the name is not defined.
	//
	Title string `yaml:",omitempty"`
	//
	//  body defines the commit body of the commit message as defined by the
	//  conventional commit specification. More information on
	//  -> https://www.conventionalcommits.org/en/
	//
	//  default:
	//    none
	//
	Body string `yaml:",omitempty"`
	//
	//  hideCredit defines if updatecli credits should be displayed inside commit message body
	//
	//  please consider sponsoring the Updatecli project if you want to disable credits.
	//  -> https://github.com/updatecli/updatecli
	//
	//  default:
	//  	false
	//
	HideCredit bool `yaml:",omitempty"`
	//  squash defines if the commit should be squashed
	//
	//  default:
	//  	false
	//
	//  important:
	//   if squash is set to to true, then it's highly recommended to set the commit title and body
	//   to a meaningful value as all other commit information will be lost during the squash operation.
	//
	//   if title and body are not set, then the commit title/message will be generated based on the most recent commit
	//   message of the squashed commits.
	//
	Squash *bool `yaml:",omitempty"`
}

Commit contains conventional commit information More information on what is conventional commits -> https://www.conventionalcommits.org/en/v1.0.0/#summary

func (*Commit) Generate

func (c *Commit) Generate(raw string) (string, error)

Generate generates the conventional commit

func (*Commit) IsSquash added in v0.108.0

func (c *Commit) IsSquash() bool

IsSquash returns true if the commit should be squashed

func (*Commit) ParseMessage

func (c *Commit) ParseMessage(message string) (Commit, error)

ParseMessage parses a message then return the commit message title and its body. The message title can't be longer than 72 characters

func (*Commit) Validate

func (c *Commit) Validate() error

Validate validates "conventional commit" default parameters.

Jump to

Keyboard shortcuts

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