Documentation ¶
Index ¶
- func NewDummyAppConfig() *config.AppConfig
- func NewDummyLog() *logrus.Entry
- func RunCommandWithOutputLiveWrapper(c *OSCommand, command string, output func(string) string) error
- type Branch
- type Commit
- type Conflict
- type File
- type GitCommand
- func (c *GitCommand) AbortMerge() error
- func (c *GitCommand) AddPatch(filename string) *exec.Cmd
- func (c *GitCommand) AmendHead() (*exec.Cmd, error)
- func (c *GitCommand) AmendTo(sha string) error
- func (c *GitCommand) ApplyPatch(patch string) (string, error)
- func (c *GitCommand) CatFile(fileName string) (string, error)
- func (c *GitCommand) CheckRemoteBranchExists(branch *Branch) bool
- func (c *GitCommand) Checkout(branch string, force bool) error
- func (c *GitCommand) CherryPickCommits(commits []*Commit) error
- func (c *GitCommand) Commit(message string) (*exec.Cmd, error)
- func (c *GitCommand) CurrentBranchName() (string, error)
- func (c *GitCommand) DeleteBranch(branch string, force bool) error
- func (c *GitCommand) Diff(file *File, plain bool) string
- func (c *GitCommand) EditRebaseTodo(index int, action string) error
- func (c *GitCommand) FastForward(branchName string) error
- func (c *GitCommand) Fetch(unamePassQuestion func(string) string, canAskForCredentials bool) error
- func (c *GitCommand) GenerateGenericRebaseTodo(commits []*Commit, index int, action string) (string, error)
- func (c *GitCommand) GenericMerge(commandType string, command string) error
- func (c *GitCommand) GetBranchGraph(branchName string) (string, error)
- func (c *GitCommand) GetBranchUpstreamDifferenceCount(branchName string) (string, string)
- func (c *GitCommand) GetCommitDifferences(from, to string) (string, string)
- func (c *GitCommand) GetCurrentBranchUpstreamDifferenceCount() (string, string)
- func (c *GitCommand) GetRemoteURL() string
- func (c *GitCommand) GetStashEntries() []*StashEntry
- func (c *GitCommand) GetStashEntryDiff(index int) (string, error)
- func (c *GitCommand) GetStatusFiles() []*File
- func (c *GitCommand) GitStatus() (string, error)
- func (c *GitCommand) HardReset(baseSha string) error
- func (c *GitCommand) Ignore(filename string) error
- func (c *GitCommand) InteractiveRebase(commits []*Commit, index int, action string) error
- func (c *GitCommand) IsInMergeState() (bool, error)
- func (c *GitCommand) ListStash() (string, error)
- func (c *GitCommand) Merge(branchName string) error
- func (c *GitCommand) MergeStatusFiles(oldFiles, newFiles []*File) []*File
- func (c *GitCommand) MoveCommitDown(commits []*Commit, index int) error
- func (c *GitCommand) MoveTodoDown(index int) error
- func (c *GitCommand) NewBranch(name string) error
- func (c *GitCommand) PrepareCommitAmendSubProcess() *exec.Cmd
- func (c *GitCommand) PrepareCommitSubProcess() *exec.Cmd
- func (c *GitCommand) PrepareInteractiveRebaseCommand(baseSha string, todo string, overrideEditor bool) (*exec.Cmd, error)
- func (c *GitCommand) Pull(ask func(string) string) error
- func (c *GitCommand) Push(branchName string, force bool, ask func(string) string) error
- func (c *GitCommand) RebaseBranch(branchName string) error
- func (c *GitCommand) RebaseMode() (string, error)
- func (c *GitCommand) RemoveFile(file *File) error
- func (c *GitCommand) RenameCommit(name string) error
- func (c *GitCommand) ResetAndClean() error
- func (c *GitCommand) ResetToCommit(sha string) error
- func (c *GitCommand) Revert(sha string) error
- func (c *GitCommand) RewordCommit(commits []*Commit, index int) (*exec.Cmd, error)
- func (c *GitCommand) RunSkipEditorCommand(command string) error
- func (c *GitCommand) Show(sha string) (string, error)
- func (c *GitCommand) SoftReset(baseSha string) error
- func (c *GitCommand) StageAll() error
- func (c *GitCommand) StageFile(fileName string) error
- func (c *GitCommand) StashDo(index int, method string) error
- func (c *GitCommand) StashSave(message string) error
- func (c *GitCommand) UnStageFile(fileName string, tracked bool) error
- func (c *GitCommand) UnstageAll() error
- type OSCommand
- func (c *OSCommand) AppendLineToFile(filename, line string) error
- func (c *OSCommand) CreateTempFile(filename, content string) (string, error)
- func (c *OSCommand) DetectUnamePass(command string, ask func(string) string) error
- func (c *OSCommand) EditFile(filename string) (*exec.Cmd, error)
- func (c *OSCommand) ExecutableFromString(commandStr string) *exec.Cmd
- func (c *OSCommand) FileExists(path string) (bool, error)
- func (c *OSCommand) FileType(path string) string
- func (c *OSCommand) GetLazygitPath() string
- func (c *OSCommand) OpenFile(filename string) error
- func (c *OSCommand) OpenLink(link string) error
- func (c *OSCommand) PrepareSubProcess(cmdName string, commandArgs ...string) *exec.Cmd
- func (c *OSCommand) Quote(message string) string
- func (c *OSCommand) RemoveFile(filename string) error
- func (c *OSCommand) RunCommand(command string) error
- func (c *OSCommand) RunCommandWithOutput(command string) (string, error)
- func (c *OSCommand) RunCommandWithOutputLive(command string, output func(string) string) error
- func (c *OSCommand) RunDirectCommand(command string) (string, error)
- func (c *OSCommand) RunExecutable(cmd *exec.Cmd) error
- func (c *OSCommand) RunExecutableWithOutput(cmd *exec.Cmd) (string, error)
- func (c *OSCommand) RunPreparedCommand(cmd *exec.Cmd) error
- func (c *OSCommand) SetCommand(cmd func(string, ...string) *exec.Cmd)
- func (c *OSCommand) Unquote(message string) string
- type Platform
- type PullRequest
- type RepoInformation
- type Service
- type StashEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDummyAppConfig ¶ added in v0.7.1
NewDummyAppConfig creates a new dummy AppConfig for testing
func NewDummyLog ¶ added in v0.7.1
NewDummyLog creates a new dummy Log for testing
func RunCommandWithOutputLiveWrapper ¶ added in v0.7.1
func RunCommandWithOutputLiveWrapper(c *OSCommand, command string, output func(string) string) error
RunCommandWithOutputLiveWrapper runs a command and return every word that gets written in stdout Output is a function that executes by every word that gets read by bufio As return of output you need to give a string that will be written to stdin NOTE: If the return data is empty it won't written anything to stdin
Types ¶
type Branch ¶
Branch : A git branch duplicating this for now
func (*Branch) GetDisplayStrings ¶ added in v0.3.0
GetDisplayStrings returns the dispaly string of branch
type Commit ¶
type Commit struct { Sha string Name string Status string // one of "unpushed", "pushed", "merged", or "rebasing" DisplayString string Action string // one of "", "pick", "edit", "squash", "reword", "drop", "fixup" Copied bool // to know if this commit is ready to be cherry-picked somewhere }
Commit : A git commit
func (*Commit) GetDisplayStrings ¶ added in v0.3.0
GetDisplayStrings is a function.
type Conflict ¶
Conflict : A git conflict with a start middle and end corresponding to line numbers in the file where the conflict bars appear
type File ¶
type File struct { Name string HasStagedChanges bool HasUnstagedChanges bool Tracked bool Deleted bool HasMergeConflicts bool HasInlineMergeConflicts bool DisplayString string Type string // one of 'file', 'directory', and 'other' }
File : A file from git status duplicating this for now
func (*File) GetDisplayStrings ¶ added in v0.3.0
GetDisplayStrings returns the display string of a file
type GitCommand ¶
type GitCommand struct { Log *logrus.Entry OSCommand *OSCommand Worktree *gogit.Worktree Repo *gogit.Repository Tr *i18n.Localizer Config config.AppConfigurer // contains filtered or unexported fields }
GitCommand is our main git interface
func NewDummyGitCommand ¶ added in v0.7.1
func NewDummyGitCommand() *GitCommand
NewDummyGitCommand creates a new dummy GitCommand for testing
func NewDummyGitCommandWithOSCommand ¶ added in v0.7.1
func NewDummyGitCommandWithOSCommand(osCommand *OSCommand) *GitCommand
NewDummyGitCommandWithOSCommand creates a new dummy GitCommand for testing
func NewGitCommand ¶
func NewGitCommand(log *logrus.Entry, osCommand *OSCommand, tr *i18n.Localizer, config config.AppConfigurer) (*GitCommand, error)
NewGitCommand it runs git commands
func (*GitCommand) AddPatch ¶
func (c *GitCommand) AddPatch(filename string) *exec.Cmd
AddPatch prepares a subprocess for adding a patch by patch this will eventually be swapped out for a better solution inside the Gui
func (*GitCommand) AmendHead ¶ added in v0.7.1
func (c *GitCommand) AmendHead() (*exec.Cmd, error)
AmendHead amends HEAD with whatever is staged in your working tree
func (*GitCommand) AmendTo ¶ added in v0.7.1
func (c *GitCommand) AmendTo(sha string) error
AmendTo amends the given commit with whatever files are staged
func (*GitCommand) ApplyPatch ¶ added in v0.7.1
func (c *GitCommand) ApplyPatch(patch string) (string, error)
func (*GitCommand) CatFile ¶
func (c *GitCommand) CatFile(fileName string) (string, error)
CatFile obtains the content of a file
func (*GitCommand) CheckRemoteBranchExists ¶ added in v0.7.1
func (c *GitCommand) CheckRemoteBranchExists(branch *Branch) bool
CheckRemoteBranchExists Returns remote branch
func (*GitCommand) Checkout ¶
func (c *GitCommand) Checkout(branch string, force bool) error
Checkout checks out a branch, with --force if you set the force arg to true
func (*GitCommand) CherryPickCommits ¶ added in v0.7.1
func (c *GitCommand) CherryPickCommits(commits []*Commit) error
CherryPickCommits begins an interactive rebase with the given shas being cherry picked onto HEAD
func (*GitCommand) Commit ¶
func (c *GitCommand) Commit(message string) (*exec.Cmd, error)
Commit commits to git
func (*GitCommand) CurrentBranchName ¶ added in v0.7.1
func (c *GitCommand) CurrentBranchName() (string, error)
CurrentBranchName is a function.
func (*GitCommand) DeleteBranch ¶
func (c *GitCommand) DeleteBranch(branch string, force bool) error
DeleteBranch delete branch
func (*GitCommand) Diff ¶
func (c *GitCommand) Diff(file *File, plain bool) string
Diff returns the diff of a file
func (*GitCommand) EditRebaseTodo ¶ added in v0.7.1
func (c *GitCommand) EditRebaseTodo(index int, action string) error
EditRebaseTodo sets the action at a given index in the git-rebase-todo file
func (*GitCommand) FastForward ¶ added in v0.7.1
func (c *GitCommand) FastForward(branchName string) error
func (*GitCommand) Fetch ¶
func (c *GitCommand) Fetch(unamePassQuestion func(string) string, canAskForCredentials bool) error
Fetch fetch git repo
func (*GitCommand) GenerateGenericRebaseTodo ¶ added in v0.7.1
func (*GitCommand) GenericMerge ¶ added in v0.7.1
func (c *GitCommand) GenericMerge(commandType string, command string) error
GenericMerge takes a commandType of "merge" or "rebase" and a command of "abort", "skip" or "continue" By default we skip the editor in the case where a commit will be made
func (*GitCommand) GetBranchGraph ¶
func (c *GitCommand) GetBranchGraph(branchName string) (string, error)
GetBranchGraph gets the color-formatted graph of the log for the given branch Currently it limits the result to 100 commits, but when we get async stuff working we can do lazy loading
func (*GitCommand) GetBranchUpstreamDifferenceCount ¶ added in v0.7.1
func (c *GitCommand) GetBranchUpstreamDifferenceCount(branchName string) (string, string)
func (*GitCommand) GetCommitDifferences ¶ added in v0.7.1
func (c *GitCommand) GetCommitDifferences(from, to string) (string, string)
GetCommitDifferences checks how many pushables/pullables there are for the current branch
func (*GitCommand) GetCurrentBranchUpstreamDifferenceCount ¶ added in v0.7.1
func (c *GitCommand) GetCurrentBranchUpstreamDifferenceCount() (string, string)
func (*GitCommand) GetRemoteURL ¶ added in v0.7.1
func (c *GitCommand) GetRemoteURL() string
GetRemoteURL returns current repo remote url
func (*GitCommand) GetStashEntries ¶
func (c *GitCommand) GetStashEntries() []*StashEntry
GetStashEntries stash entryies
func (*GitCommand) GetStashEntryDiff ¶
func (c *GitCommand) GetStashEntryDiff(index int) (string, error)
GetStashEntryDiff stash diff
func (*GitCommand) GetStatusFiles ¶
func (c *GitCommand) GetStatusFiles() []*File
GetStatusFiles git status files
func (*GitCommand) GitStatus ¶
func (c *GitCommand) GitStatus() (string, error)
GitStatus returns the plaintext short status of the repo
func (*GitCommand) HardReset ¶ added in v0.7.1
func (c *GitCommand) HardReset(baseSha string) error
func (*GitCommand) Ignore ¶
func (c *GitCommand) Ignore(filename string) error
Ignore adds a file to the gitignore for the repo
func (*GitCommand) InteractiveRebase ¶ added in v0.7.1
func (c *GitCommand) InteractiveRebase(commits []*Commit, index int, action string) error
func (*GitCommand) IsInMergeState ¶
func (c *GitCommand) IsInMergeState() (bool, error)
IsInMergeState states whether we are still mid-merge
func (*GitCommand) ListStash ¶
func (c *GitCommand) ListStash() (string, error)
ListStash list stash
func (*GitCommand) MergeStatusFiles ¶
func (c *GitCommand) MergeStatusFiles(oldFiles, newFiles []*File) []*File
MergeStatusFiles merge status files
func (*GitCommand) MoveCommitDown ¶ added in v0.7.1
func (c *GitCommand) MoveCommitDown(commits []*Commit, index int) error
func (*GitCommand) MoveTodoDown ¶ added in v0.7.1
func (c *GitCommand) MoveTodoDown(index int) error
MoveTodoDown moves a rebase todo item down by one position
func (*GitCommand) NewBranch ¶
func (c *GitCommand) NewBranch(name string) error
NewBranch create new branch
func (*GitCommand) PrepareCommitAmendSubProcess ¶ added in v0.2.2
func (c *GitCommand) PrepareCommitAmendSubProcess() *exec.Cmd
PrepareCommitAmendSubProcess prepares a subprocess for `git commit --amend --allow-empty`
func (*GitCommand) PrepareCommitSubProcess ¶
func (c *GitCommand) PrepareCommitSubProcess() *exec.Cmd
PrepareCommitSubProcess prepares a subprocess for `git commit`
func (*GitCommand) PrepareInteractiveRebaseCommand ¶ added in v0.7.1
func (c *GitCommand) PrepareInteractiveRebaseCommand(baseSha string, todo string, overrideEditor bool) (*exec.Cmd, error)
PrepareInteractiveRebaseCommand returns the cmd for an interactive rebase we tell git to run lazygit to edit the todo list, and we pass the client lazygit a todo string to write to the todo file
func (*GitCommand) Pull ¶
func (c *GitCommand) Pull(ask func(string) string) error
Pull pulls from repo
func (*GitCommand) RebaseBranch ¶ added in v0.7.1
func (c *GitCommand) RebaseBranch(branchName string) error
RebaseBranch interactive rebases onto a branch
func (*GitCommand) RebaseMode ¶ added in v0.7.1
func (c *GitCommand) RebaseMode() (string, error)
RebaseMode returns "" for non-rebase mode, "normal" for normal rebase and "interactive" for interactive rebase
func (*GitCommand) RemoveFile ¶
func (c *GitCommand) RemoveFile(file *File) error
RemoveFile directly
func (*GitCommand) RenameCommit ¶
func (c *GitCommand) RenameCommit(name string) error
RenameCommit renames the topmost commit with the given name
func (*GitCommand) ResetAndClean ¶ added in v0.7.1
func (c *GitCommand) ResetAndClean() error
ResetAndClean removes all unstaged changes and removes all untracked files
func (*GitCommand) ResetToCommit ¶
func (c *GitCommand) ResetToCommit(sha string) error
ResetToCommit reset to commit
func (*GitCommand) Revert ¶ added in v0.7.1
func (c *GitCommand) Revert(sha string) error
Revert reverts the selected commit by sha
func (*GitCommand) RewordCommit ¶ added in v0.7.1
func (*GitCommand) RunSkipEditorCommand ¶ added in v0.7.1
func (c *GitCommand) RunSkipEditorCommand(command string) error
func (*GitCommand) Show ¶
func (c *GitCommand) Show(sha string) (string, error)
Show shows the diff of a commit
func (*GitCommand) SoftReset ¶ added in v0.7.1
func (c *GitCommand) SoftReset(baseSha string) error
func (*GitCommand) StageAll ¶ added in v0.2.0
func (c *GitCommand) StageAll() error
StageAll stages all files
func (*GitCommand) StageFile ¶
func (c *GitCommand) StageFile(fileName string) error
StageFile stages a file
func (*GitCommand) StashDo ¶
func (c *GitCommand) StashDo(index int, method string) error
StashDo modify stash
func (*GitCommand) StashSave ¶
func (c *GitCommand) StashSave(message string) error
StashSave save stash TODO: before calling this, check if there is anything to save
func (*GitCommand) UnStageFile ¶
func (c *GitCommand) UnStageFile(fileName string, tracked bool) error
UnStageFile unstages a file
func (*GitCommand) UnstageAll ¶ added in v0.2.0
func (c *GitCommand) UnstageAll() error
UnstageAll stages all files
type OSCommand ¶
type OSCommand struct { Log *logrus.Entry Platform *Platform Config config.AppConfigurer // contains filtered or unexported fields }
OSCommand holds all the os commands
func NewDummyOSCommand ¶ added in v0.7.1
func NewDummyOSCommand() *OSCommand
NewDummyOSCommand creates a new dummy OSCommand for testing
func NewOSCommand ¶
func NewOSCommand(log *logrus.Entry, config config.AppConfigurer) *OSCommand
NewOSCommand os command runner
func (*OSCommand) AppendLineToFile ¶ added in v0.1.73
AppendLineToFile adds a new line in file
func (*OSCommand) CreateTempFile ¶ added in v0.7.1
CreateTempFile writes a string to a new temp file and returns the file's name
func (*OSCommand) DetectUnamePass ¶ added in v0.7.1
DetectUnamePass detect a username / password question in a command ask is a function that gets executen when this function detect you need to fillin a password The ask argument will be "username" or "password" and expects the user's password or username back
func (*OSCommand) EditFile ¶
EditFile opens a file in a subprocess using whatever editor is available, falling back to core.editor, VISUAL, EDITOR, then vi
func (*OSCommand) ExecutableFromString ¶ added in v0.7.1
ExecutableFromString takes a string like `git status` and returns an executable command for it
func (*OSCommand) FileExists ¶ added in v0.7.1
FileExists checks whether a file exists at the specified path
func (*OSCommand) FileType ¶ added in v0.2.0
FileType tells us if the file is a file, directory or other
func (*OSCommand) GetLazygitPath ¶ added in v0.7.1
GetLazygitPath returns the path of the currently executed file
func (*OSCommand) PrepareSubProcess ¶
PrepareSubProcess iniPrepareSubProcessrocess then tells the Gui to switch to it
func (*OSCommand) RemoveFile ¶ added in v0.7.1
RemoveFile removes a file at the specified path
func (*OSCommand) RunCommand ¶
RunCommand runs a command and just returns the error
func (*OSCommand) RunCommandWithOutput ¶
RunCommandWithOutput wrapper around commands returning their output and error
func (*OSCommand) RunCommandWithOutputLive ¶ added in v0.7.1
RunCommandWithOutputLive runs RunCommandWithOutputLiveWrapper
func (*OSCommand) RunDirectCommand ¶
RunDirectCommand wrapper around direct commands
func (*OSCommand) RunExecutable ¶ added in v0.7.1
RunExecutable runs an executable file and returns an error if there was one
func (*OSCommand) RunExecutableWithOutput ¶ added in v0.7.1
RunExecutableWithOutput runs an executable file and returns its output
func (*OSCommand) RunPreparedCommand ¶ added in v0.7.1
RunPreparedCommand takes a pointer to an exec.Cmd and runs it this is useful if you need to give your command some environment variables before running it
func (*OSCommand) SetCommand ¶ added in v0.7.1
SetCommand sets the command function used by the struct. To be used for testing only
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform stores the os state
type PullRequest ¶ added in v0.7.1
type PullRequest struct { GitServices []*Service GitCommand *GitCommand }
PullRequest opens a link in browser to create new pull request with selected branch
func NewPullRequest ¶ added in v0.7.1
func NewPullRequest(gitCommand *GitCommand) *PullRequest
NewPullRequest creates new instance of PullRequest
func (*PullRequest) Create ¶ added in v0.7.1
func (pr *PullRequest) Create(branch *Branch) error
Create opens link to new pull request in browser
type RepoInformation ¶ added in v0.7.1
RepoInformation holds some basic information about the repo
type StashEntry ¶
StashEntry : A git stash entry
func (*StashEntry) GetDisplayStrings ¶ added in v0.3.0
func (s *StashEntry) GetDisplayStrings(isFocused bool) []string
GetDisplayStrings returns the dispaly string of branch