commit

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:   "commit",
	Short: "Manage commits",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Commit requires a subcommand:")
		for _, command := range cmd.Commands() {
			fmt.Println(command.Name())
		}
	},
}

Command represents this folder's command

Functions

func GetCommitHashes

func GetCommitHashes(context context.Context, cmd *cobra.Command, args []string, toComplete string) (hashes []string, err error)

GetCommitHashes gets the commit hashes of a repository

Types

type Commit

type Commit struct {
	Hash       string                `json:"hash"               mapstructure:"hash"`
	Author     user.Author           `json:"author"             mapstructure:"author"`
	Message    string                `json:"message"            mapstructure:"message"`
	Summary    *common.RenderedText  `json:"summary,omitempty"  mapstructure:"summary"`
	Rendered   *RenderedMessage      `json:"rendered,omitempty" mapstructure:"rendered"`
	Parents    []CommitReference     `json:"parents,omitempty"  mapstructure:"parents"`
	Date       time.Time             `json:"date"               mapstructure:"date"`
	Repository repository.Repository `json:"repository"         mapstructure:"repository"`
	Links      common.Links          `json:"links"              mapstructure:"links"`
}

func GetCommitByHash

func GetCommitByHash(ctx context.Context, cmd *cobra.Command, hash string) (commit *Commit, err error)

GetCommitByHash gets a commit by its hash

func GetCommits

func GetCommits(context context.Context, cmd *cobra.Command) (commits []Commit, err error)

GetCommits gets the commits of a repository

func GetCommitsWithPrefix

func GetCommitsWithPrefix(context context.Context, cmd *cobra.Command, prefix string) (commits []Commit, err error)

GetCommitsWithPrefix gets the commits of a repository with a prefix

func GetLatestCommit

func GetLatestCommit(ctx context.Context, cmd *cobra.Command) (commit *Commit, err error)

GetLatestCommit gets the latest commit of the repository

func (Commit) GetColumnDefinitions

func (commit Commit) GetColumnDefinitions() common.Columns[Commit]

GetColumnDefinitions gets the column definitions for commits

func (Commit) GetHeaders

func (commit Commit) GetHeaders(cmd *cobra.Command) []string

GetHeaders gets the header for a table

implements common.Tableable

func (Commit) GetReference

func (commit Commit) GetReference() *CommitReference

GetReference gets the reference string for this commit

func (Commit) GetRow

func (commit Commit) GetRow(headers []string) []string

GetRow gets the row for a table

implements common.Tableable

func (Commit) GetShortHash

func (commit Commit) GetShortHash() string

GetShortHash gets the short hash of this commit

func (Commit) GetType

func (commit Commit) GetType() string

GetType gets the type of this commit

implements core.TypeCarrier

func (Commit) MarshalJSON

func (commit Commit) MarshalJSON() (data []byte, err error)

MarshalJSON implements the json.Marshaler interface.

func (Commit) String

func (commit Commit) String() string

String gets a string representation of this commit

implements fmt.Stringer

func (*Commit) Validate

func (commit *Commit) Validate() error

Validate validates a Commit

type CommitReference

type CommitReference struct {
	Hash  string       `json:"hash"  mapstructure:"hash"`
	Links common.Links `json:"links" mapstructure:"links"`
}

func (CommitReference) AsCommit

func (reference CommitReference) AsCommit() *Commit

AsCommit converts this CommitRef to a Commit

func (CommitReference) GetShortHash

func (reference CommitReference) GetShortHash() string

GetShortHash gets the short hash of this commit

func (CommitReference) MarshalJSON

func (reference CommitReference) MarshalJSON() (data []byte, err error)

MarshalJSON implements the json.Marshaler interface.

func (CommitReference) String

func (reference CommitReference) String() string

String gets a string representation of this commit

implements fmt.Stringer

type Commits

type Commits []Commit

func (Commits) GetHeaders

func (commits Commits) GetHeaders(cmd *cobra.Command) []string

GetHeaders gets the header for a table

implements common.Tableables

func (Commits) GetRowAt

func (commits Commits) GetRowAt(index int, headers []string) []string

GetRowAt gets the row for a table

implements common.Tableables

func (Commits) Size

func (commits Commits) Size() int

Size gets the number of elements

implements common.Tableables

type RenderedMessage

type RenderedMessage struct {
	Message common.RenderedText `json:"message" mapstructure:"message"`
}

Jump to

Keyboard shortcuts

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