cmd

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

cmd package contains helper functions for various commands.

Index

Constants

View Source
const PatternDescription = `` /* 319-byte string literal not displayed */

Variables

This section is empty.

Functions

func GetOrPanic

func GetOrPanic[T any](a T, err error) T

GetOrPanic checks if err is nil, panics if not, otherwise return a

func Logger

func Logger() *slog.Logger

Return the logger for the command

func MustHash

func MustHash(s string) plumbing.Hash

MustHash gets the 20 byte hash from string

func NewFileSystem

func NewFileSystem(dir string, cache cache.Object) *filesystem.Storage

NewFileSystem obtains the absolute path to the dir and creates a new filesystem.Storage

func OrPanic

func OrPanic(err error)

OrPanic panics if err is not nil

Types

type FilterCmd

type FilterCmd struct {
	Patterns          []string
	PatternFile       string
	IgnoreUnsupported bool

	IsRequired bool
}

func (*FilterCmd) GetFilter

func (c *FilterCmd) GetFilter() gitrim.Filter

func (*FilterCmd) SetupFilterCobra

func (c *FilterCmd) SetupFilterCobra(cmd *cobra.Command, required bool)

type HistCmd

type HistCmd struct {
	NumCommit    int
	EndCommit    string
	StartCommits []string
}

HistCmd are command components used to get history

func (*HistCmd) GetHistory

func (c *HistCmd) GetHistory(ctx context.Context, s storer.Storer) []*object.Commit

GetHistory returns the linear history

type LogCmd

type LogCmd struct {
	LogLevel int
}

LogCmd contains cmd's log configuration.

func (*LogCmd) InitLog

func (c *LogCmd) InitLog()

type SetBranchCmd

type SetBranchCmd struct {
	Branch  string
	SetHead bool
}

SetBranchCmd is for output the commit to a branch and potentially set it to head.

func (*SetBranchCmd) SetBrancHead

func (c *SetBranchCmd) SetBrancHead(s storer.Storer, h plumbing.Hash)

SetBrancHead sets the has as the branch

func (*SetBranchCmd) SetBrancHeadFromHistory

func (c *SetBranchCmd) SetBrancHeadFromHistory(s storer.Storer, newhist []*object.Commit)

Directories

Path Synopsis
dump-git-tree dumps the git tree and optionally apply pattern filters.
dump-git-tree dumps the git tree and optionally apply pattern filters.
expand-git-commit adds back the changes made in a repo filtered by filter-git-hist to the unfiltered repo.
expand-git-commit adds back the changes made in a repo filtered by filter-git-hist to the unfiltered repo.
filter-git-hist is a more robust but limited git-filter-branch.
filter-git-hist is a more robust but limited git-filter-branch.
remove-git-gpg removes gpg information from series of commits.
remove-git-gpg removes gpg information from series of commits.

Jump to

Keyboard shortcuts

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