helpers

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REBASE_OPTION_CONTINUE string = "continue"
	REBASE_OPTION_ABORT    string = "abort"
	REBASE_OPTION_SKIP     string = "skip"
)

Variables

This section is empty.

Functions

func FuzzySearchFunc

func FuzzySearchFunc(options []string) func(string) []*types.Suggestion

Types

type BisectHelper

type BisectHelper struct {
	// contains filtered or unexported fields
}

func NewBisectHelper

func NewBisectHelper(
	c *types.HelperCommon,
	git *commands.GitCommand,
) *BisectHelper

func (*BisectHelper) PostBisectCommandRefresh

func (self *BisectHelper) PostBisectCommandRefresh() error

func (*BisectHelper) Reset

func (self *BisectHelper) Reset() error

type CherryPickHelper

type CherryPickHelper struct {
	// contains filtered or unexported fields
}

func NewCherryPickHelper

func NewCherryPickHelper(
	c *types.HelperCommon,
	git *commands.GitCommand,
	contexts *context.ContextTree,
	getData func() *cherrypicking.CherryPicking,
	rebaseHelper *MergeAndRebaseHelper,
) *CherryPickHelper

func (*CherryPickHelper) CherryPickedCommitShaSet

func (self *CherryPickHelper) CherryPickedCommitShaSet() *set.Set[string]

func (*CherryPickHelper) Copy

func (self *CherryPickHelper) Copy(commit *models.Commit, commitsList []*models.Commit, context types.Context) error

func (*CherryPickHelper) CopyRange

func (self *CherryPickHelper) CopyRange(selectedIndex int, commitsList []*models.Commit, context types.Context) error

func (*CherryPickHelper) Paste

func (self *CherryPickHelper) Paste() error

HandlePasteCommits begins a cherry-pick rebase with the commits the user has copied. Only to be called from the branch commits controller

func (*CherryPickHelper) Reset

func (self *CherryPickHelper) Reset() error

type CredentialsHelper

type CredentialsHelper struct {
	// contains filtered or unexported fields
}

func NewCredentialsHelper

func NewCredentialsHelper(
	c *types.HelperCommon,
) *CredentialsHelper

func (*CredentialsHelper) PromptUserForCredential

func (self *CredentialsHelper) PromptUserForCredential(passOrUname oscommands.CredentialType) string

promptUserForCredential wait for a username, password or passphrase input from the credentials popup

type FilesHelper

type FilesHelper struct {
	// contains filtered or unexported fields
}

func NewFilesHelper

func NewFilesHelper(
	c *types.HelperCommon,
	git *commands.GitCommand,
	os *oscommands.OSCommand,
) *FilesHelper

func (*FilesHelper) EditFile

func (self *FilesHelper) EditFile(filename string) error

func (*FilesHelper) EditFileAtLine

func (self *FilesHelper) EditFileAtLine(filename string, lineNumber int) error

func (*FilesHelper) OpenFile

func (self *FilesHelper) OpenFile(filename string) error

func (*FilesHelper) OpenFileAtLine

func (self *FilesHelper) OpenFileAtLine(filename string, lineNumber int) error

type GpgHelper

type GpgHelper struct {
	// contains filtered or unexported fields
}

func NewGpgHelper

func NewGpgHelper(
	c *types.HelperCommon,
	os *oscommands.OSCommand,
	git *commands.GitCommand,
) *GpgHelper

func (*GpgHelper) WithGpgHandling

func (self *GpgHelper) WithGpgHandling(cmdObj oscommands.ICmdObj, waitingStatus string, onSuccess func() error) error

Currently there is a bug where if we switch to a subprocess from within WithWaitingStatus we get stuck there and can't return to lazygit. We could fix this bug, or just stop running subprocesses from within there, given that we don't need to see a loading status if we're in a subprocess. TODO: we shouldn't need to use a shell here, but looks like that NewShell function contains some windows specific quoting stuff. We should centralise that.

type Helpers

type Helpers struct {
	Refs           *RefsHelper
	Bisect         *BisectHelper
	Suggestions    *SuggestionsHelper
	Files          *FilesHelper
	WorkingTree    *WorkingTreeHelper
	Tags           *TagsHelper
	MergeAndRebase *MergeAndRebaseHelper
	MergeConflicts *MergeConflictsHelper
	CherryPick     *CherryPickHelper
	Host           *HostHelper
	PatchBuilding  *PatchBuildingHelper
	GPG            *GpgHelper
	Upstream       *UpstreamHelper
}

func NewStubHelpers

func NewStubHelpers() *Helpers

type HostHelper

type HostHelper struct {
	// contains filtered or unexported fields
}

func NewHostHelper

func NewHostHelper(
	c *types.HelperCommon,
	git *commands.GitCommand,
) *HostHelper

func (*HostHelper) GetCommitURL

func (self *HostHelper) GetCommitURL(commitSha string) (string, error)

func (*HostHelper) GetPullRequestURL

func (self *HostHelper) GetPullRequestURL(from string, to string) (string, error)

type IFilesHelper

type IFilesHelper interface {
	EditFile(filename string) error
	EditFileAtLine(filename string, lineNumber int) error
	OpenFile(filename string) error
	OpenFileAtLine(filename string, lineNumber int) error
}

type IHostHelper

type IHostHelper interface {
	GetPullRequestURL(from string, to string) (string, error)
	GetCommitURL(commitSha string) (string, error)
}

type IPatchBuildingHelper

type IPatchBuildingHelper interface {
	ValidateNormalWorkingTreeState() (bool, error)
}

type IRefsHelper

type IRefsHelper interface {
	CheckoutRef(ref string, options types.CheckoutRefOptions) error
	GetCheckedOutRef() *models.Branch
	CreateGitResetMenu(ref string) error
	ResetToRef(ref string, strength string, envVars []string) error
	NewBranch(from string, fromDescription string, suggestedBranchname string) error
}

type ISuggestionsHelper

type ISuggestionsHelper interface {
	GetRemoteSuggestionsFunc() func(string) []*types.Suggestion
	GetBranchNameSuggestionsFunc() func(string) []*types.Suggestion
	GetFilePathSuggestionsFunc() func(string) []*types.Suggestion
	GetRemoteBranchesSuggestionsFunc(separator string) func(string) []*types.Suggestion
	GetRefsSuggestionsFunc() func(string) []*types.Suggestion
}

type IUpstreamHelper

type IUpstreamHelper interface {
	ParseUpstream(string) (string, string, error)
	PromptForUpstreamWithInitialContent(*models.Branch, func(string) error) error
	PromptForUpstreamWithoutInitialContent(*models.Branch, func(string) error) error
	GetSuggestedRemote() string
}

type IWorkingTreeHelper

type IWorkingTreeHelper interface {
	AnyStagedFiles() bool
	AnyTrackedFiles() bool
	IsWorkingTreeDirty() bool
	FileForSubmodule(submodule *models.SubmoduleConfig) *models.File
}

type MergeAndRebaseHelper

type MergeAndRebaseHelper struct {
	// contains filtered or unexported fields
}

func NewMergeAndRebaseHelper

func NewMergeAndRebaseHelper(
	c *types.HelperCommon,
	contexts *context.ContextTree,
	git *commands.GitCommand,
	refsHelper *RefsHelper,
) *MergeAndRebaseHelper

func (*MergeAndRebaseHelper) AbortMergeOrRebaseWithConfirm

func (self *MergeAndRebaseHelper) AbortMergeOrRebaseWithConfirm() error

func (*MergeAndRebaseHelper) CheckMergeOrRebase

func (self *MergeAndRebaseHelper) CheckMergeOrRebase(result error) error

func (*MergeAndRebaseHelper) CreateRebaseOptionsMenu

func (self *MergeAndRebaseHelper) CreateRebaseOptionsMenu() error

func (*MergeAndRebaseHelper) MergeRefIntoCheckedOutBranch

func (self *MergeAndRebaseHelper) MergeRefIntoCheckedOutBranch(refName string) error

func (*MergeAndRebaseHelper) PromptToContinueRebase

func (self *MergeAndRebaseHelper) PromptToContinueRebase() error

PromptToContinueRebase asks the user if they want to continue the rebase/merge that's in progress

func (*MergeAndRebaseHelper) RebaseOntoRef

func (self *MergeAndRebaseHelper) RebaseOntoRef(ref string) error

type MergeConflictsHelper added in v0.36.0

type MergeConflictsHelper struct {
	// contains filtered or unexported fields
}

func NewMergeConflictsHelper added in v0.36.0

func NewMergeConflictsHelper(
	c *types.HelperCommon,
	contexts *context.ContextTree,
	git *commands.GitCommand,
) *MergeConflictsHelper

func (*MergeConflictsHelper) EscapeMerge added in v0.36.0

func (self *MergeConflictsHelper) EscapeMerge() error

func (*MergeConflictsHelper) GetMergingOptions added in v0.36.0

func (self *MergeConflictsHelper) GetMergingOptions() map[string]string

func (*MergeConflictsHelper) ResetMergeState added in v0.36.0

func (self *MergeConflictsHelper) ResetMergeState()

func (*MergeConflictsHelper) SetConflictsAndRender added in v0.36.0

func (self *MergeConflictsHelper) SetConflictsAndRender(path string, isFocused bool) (bool, error)

func (*MergeConflictsHelper) SetMergeState added in v0.36.0

func (self *MergeConflictsHelper) SetMergeState(path string) (bool, error)

func (*MergeConflictsHelper) SwitchToMerge added in v0.36.0

func (self *MergeConflictsHelper) SwitchToMerge(path string) error

type PatchBuildingHelper

type PatchBuildingHelper struct {
	// contains filtered or unexported fields
}

func NewPatchBuildingHelper

func NewPatchBuildingHelper(
	c *types.HelperCommon,
	git *commands.GitCommand,
	contexts *context.ContextTree,
) *PatchBuildingHelper

func (*PatchBuildingHelper) Escape added in v0.36.0

func (self *PatchBuildingHelper) Escape() error

takes us from the patch building panel back to the commit files panel

func (*PatchBuildingHelper) Reset added in v0.36.0

func (self *PatchBuildingHelper) Reset() error

kills the custom patch and returns us back to the commit files panel if needed

func (*PatchBuildingHelper) ValidateNormalWorkingTreeState

func (self *PatchBuildingHelper) ValidateNormalWorkingTreeState() (bool, error)

type RebaseOption

type RebaseOption string

type RefsHelper

type RefsHelper struct {
	// contains filtered or unexported fields
}

func NewRefsHelper

func NewRefsHelper(
	c *types.HelperCommon,
	git *commands.GitCommand,
	contexts *context.ContextTree,
	model *types.Model,
) *RefsHelper

func (*RefsHelper) CheckoutRef

func (self *RefsHelper) CheckoutRef(ref string, options types.CheckoutRefOptions) error

func (*RefsHelper) CreateGitResetMenu

func (self *RefsHelper) CreateGitResetMenu(ref string) error

func (*RefsHelper) GetCheckedOutRef

func (self *RefsHelper) GetCheckedOutRef() *models.Branch

func (*RefsHelper) NewBranch

func (self *RefsHelper) NewBranch(from string, fromFormattedName string, suggestedBranchName string) error

func (*RefsHelper) ResetToRef

func (self *RefsHelper) ResetToRef(ref string, strength string, envVars []string) error

type SuggestionsHelper

type SuggestionsHelper struct {
	// contains filtered or unexported fields
}

func NewSuggestionsHelper

func NewSuggestionsHelper(
	c *types.HelperCommon,
	model *types.Model,
	refreshSuggestionsFn func(),
) *SuggestionsHelper

func (*SuggestionsHelper) GetAuthorsSuggestionsFunc

func (self *SuggestionsHelper) GetAuthorsSuggestionsFunc() func(string) []*types.Suggestion

func (*SuggestionsHelper) GetBranchNameSuggestionsFunc

func (self *SuggestionsHelper) GetBranchNameSuggestionsFunc() func(string) []*types.Suggestion

func (*SuggestionsHelper) GetFilePathSuggestionsFunc

func (self *SuggestionsHelper) GetFilePathSuggestionsFunc() func(string) []*types.Suggestion

here we asynchronously fetch the latest set of paths in the repo and store in self.model.FilesTrie. On the main thread we'll be doing a fuzzy search via self.model.FilesTrie. So if we've looked for a file previously, we'll start with the old trie and eventually it'll be swapped out for the new one. Notably, unlike other suggestion functions we're not showing all the options if nothing has been typed because there'll be too much to display efficiently

func (*SuggestionsHelper) GetRefsSuggestionsFunc

func (self *SuggestionsHelper) GetRefsSuggestionsFunc() func(string) []*types.Suggestion

func (*SuggestionsHelper) GetRemoteBranchesSuggestionsFunc

func (self *SuggestionsHelper) GetRemoteBranchesSuggestionsFunc(separator string) func(string) []*types.Suggestion

func (*SuggestionsHelper) GetRemoteSuggestionsFunc

func (self *SuggestionsHelper) GetRemoteSuggestionsFunc() func(string) []*types.Suggestion

type TagsHelper

type TagsHelper struct {
	// contains filtered or unexported fields
}

func NewTagsHelper

func NewTagsHelper(c *types.HelperCommon, git *commands.GitCommand) *TagsHelper

func (*TagsHelper) CreateTagMenu

func (self *TagsHelper) CreateTagMenu(commitSha string, onCreate func()) error

type UpstreamHelper

type UpstreamHelper struct {
	// contains filtered or unexported fields
}

func NewUpstreamHelper

func NewUpstreamHelper(
	c *types.HelperCommon,
	model *types.Model,
	getRemoteBranchesSuggestionsFunc func(string) func(string) []*types.Suggestion,
) *UpstreamHelper

func (*UpstreamHelper) GetSuggestedRemote

func (self *UpstreamHelper) GetSuggestedRemote() string

func (*UpstreamHelper) ParseUpstream

func (self *UpstreamHelper) ParseUpstream(upstream string) (string, string, error)

func (*UpstreamHelper) PromptForUpstreamWithInitialContent

func (self *UpstreamHelper) PromptForUpstreamWithInitialContent(currentBranch *models.Branch, onConfirm func(string) error) error

func (*UpstreamHelper) PromptForUpstreamWithoutInitialContent

func (self *UpstreamHelper) PromptForUpstreamWithoutInitialContent(_ *models.Branch, onConfirm func(string) error) error

type WorkingTreeHelper

type WorkingTreeHelper struct {
	// contains filtered or unexported fields
}

func NewWorkingTreeHelper

func NewWorkingTreeHelper(
	c *types.HelperCommon,
	git *commands.GitCommand,
	contexts *context.ContextTree,
	refHelper *RefsHelper,
	model *types.Model,
	setCommitMessage func(message string),
	getSavedCommitMessage func() string,
) *WorkingTreeHelper

func (*WorkingTreeHelper) AnyStagedFiles

func (self *WorkingTreeHelper) AnyStagedFiles() bool

func (*WorkingTreeHelper) AnyTrackedFiles

func (self *WorkingTreeHelper) AnyTrackedFiles() bool

func (*WorkingTreeHelper) FileForSubmodule

func (self *WorkingTreeHelper) FileForSubmodule(submodule *models.SubmoduleConfig) *models.File

func (*WorkingTreeHelper) HandleCommitEditorPress added in v0.37.0

func (self *WorkingTreeHelper) HandleCommitEditorPress() error

HandleCommitEditorPress - handle when the user wants to commit changes via their editor rather than via the popup panel

func (*WorkingTreeHelper) HandleCommitPress added in v0.37.0

func (self *WorkingTreeHelper) HandleCommitPress() error

func (*WorkingTreeHelper) HandleWIPCommitPress added in v0.37.0

func (self *WorkingTreeHelper) HandleWIPCommitPress() error

func (*WorkingTreeHelper) IsWorkingTreeDirty

func (self *WorkingTreeHelper) IsWorkingTreeDirty() bool

func (*WorkingTreeHelper) OpenMergeTool

func (self *WorkingTreeHelper) OpenMergeTool() error

func (*WorkingTreeHelper) PromptToStageAllAndRetry added in v0.37.0

func (self *WorkingTreeHelper) PromptToStageAllAndRetry(retry func() error) error

Jump to

Keyboard shortcuts

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