Documentation
¶
Index ¶
- Constants
- Variables
- func GetKeyDisplay(key interface{}) string
- func NewFileWatcher(log *logrus.Entry) *fileWatcher
- func NewRenderStringTask(str string) *renderStringTask
- func NewRenderStringWithoutScrollTask(str string) *renderStringWithoutScrollTask
- func NewRunCommandTask(cmd *exec.Cmd) *runCommandTask
- func NewRunCommandTaskWithPrefix(cmd *exec.Cmd, prefix string) *runCommandTask
- func NewRunPtyTask(cmd *exec.Cmd) *runPtyTask
- type BasicContext
- func (c BasicContext) GetKey() ContextKey
- func (c BasicContext) GetKind() ContextKind
- func (c BasicContext) GetOptionsMap() map[string]string
- func (c BasicContext) GetParentContext() (Context, bool)
- func (c BasicContext) GetViewName() string
- func (c BasicContext) GetWindowName() string
- func (c BasicContext) HandleFocus() error
- func (c BasicContext) HandleFocusLost() error
- func (c BasicContext) HandleRender() error
- func (c BasicContext) SetParentContext(Context)
- func (c BasicContext) SetWindowName(windowName string)
- type Binding
- type CherryPicking
- type Context
- type ContextKey
- type ContextKind
- type ContextManager
- type ContextTree
- type CustomCommandObjects
- type Diffing
- type Gui
- func (gui *Gui) GetCustomCommandKeybindings() []*Binding
- func (gui *Gui) GetInitialKeybindings() []*Binding
- func (gui *Gui) HandlePasteCommits() error
- func (gui *Gui) LBLCycleLine(change int, state *lBlPanelState) error
- func (gui *Gui) LBLSelectLine(newSelectedLineIdx int, state *lBlPanelState) error
- func (gui *Gui) RenderCommitLength()
- func (gui *Gui) Run() error
- func (gui *Gui) RunAndHandleError() error
- func (gui *Gui) WithWaitingStatus(message string, f func() error) error
- type IListPanelState
- type ListContext
- func (lc *ListContext) GetKey() ContextKey
- func (lc *ListContext) GetKind() ContextKind
- func (lc *ListContext) GetOptionsMap() map[string]string
- func (lc *ListContext) GetParentContext() (Context, bool)
- func (lc *ListContext) GetSelectedItem() (ListItem, bool)
- func (lc *ListContext) GetSelectedItemId() string
- func (lc *ListContext) GetViewName() string
- func (lc *ListContext) GetWindowName() string
- func (lc *ListContext) HandleFocus() error
- func (lc *ListContext) HandleFocusLost() error
- func (lc *ListContext) HandleRender() error
- func (lc *ListContext) OnRender() error
- func (lc *ListContext) SetParentContext(c Context)
- func (lc *ListContext) SetWindowName(windowName string)
- type ListItem
- type Modes
- type PullFilesOptions
- type ReflogActionKind
- type RefreshMode
- type RefreshableView
- type Repo
- type SelectMode
- type StartupStage
- type TaskKind
- type Views
- type WindowMaximisation
Constants ¶
const INFO_SECTION_PADDING = " "
const MAX_WATCHED_FILES = 50
macs for some bizarre reason cap the number of watchable files to 256. there's no obvious platform agonstic way to check the situation of the user's computer so we're just arbitrarily capping at 200. This isn't so bad because file watching is only really an added bonus for faster refreshing.
const SEARCH_PREFIX = "search: "
const StartupPopupVersion = 3
const UNKNOWN_VIEW_ERROR_MSG = "unknown view"
Variables ¶
var OverlappingEdges = false
OverlappingEdges determines if panel edges overlap
Functions ¶
func GetKeyDisplay ¶ added in v0.12.1
func GetKeyDisplay(key interface{}) string
func NewFileWatcher ¶ added in v0.12.1
func NewRenderStringTask ¶ added in v0.27.1
func NewRenderStringTask(str string) *renderStringTask
func NewRenderStringWithoutScrollTask ¶ added in v0.27.1
func NewRenderStringWithoutScrollTask(str string) *renderStringWithoutScrollTask
func NewRunCommandTask ¶ added in v0.27.1
func NewRunCommandTaskWithPrefix ¶ added in v0.27.1
func NewRunPtyTask ¶ added in v0.27.1
Types ¶
type BasicContext ¶ added in v0.22.0
type BasicContext struct {
OnFocus func() error
OnFocusLost func() error
OnRender func() error
OnGetOptionsMap func() map[string]string
Kind ContextKind
Key ContextKey
ViewName string
}
func (BasicContext) GetKey ¶ added in v0.22.0
func (c BasicContext) GetKey() ContextKey
func (BasicContext) GetKind ¶ added in v0.22.0
func (c BasicContext) GetKind() ContextKind
func (BasicContext) GetOptionsMap ¶ added in v0.22.0
func (c BasicContext) GetOptionsMap() map[string]string
func (BasicContext) GetParentContext ¶ added in v0.22.0
func (c BasicContext) GetParentContext() (Context, bool)
func (BasicContext) GetViewName ¶ added in v0.22.0
func (c BasicContext) GetViewName() string
func (BasicContext) GetWindowName ¶ added in v0.22.0
func (c BasicContext) GetWindowName() string
func (BasicContext) HandleFocus ¶ added in v0.22.0
func (c BasicContext) HandleFocus() error
func (BasicContext) HandleFocusLost ¶ added in v0.22.0
func (c BasicContext) HandleFocusLost() error
func (BasicContext) HandleRender ¶ added in v0.22.0
func (c BasicContext) HandleRender() error
func (BasicContext) SetParentContext ¶ added in v0.22.0
func (c BasicContext) SetParentContext(Context)
func (BasicContext) SetWindowName ¶ added in v0.22.0
func (c BasicContext) SetWindowName(windowName string)
type Binding ¶
type Binding struct {
ViewName string
Contexts []string
Handler func() error
Key interface{} // FIXME: find out how to get `gocui.Key | rune`
Modifier gocui.Modifier
Description string
Alternative string
Tag string // e.g. 'navigation'. Used for grouping things in the cheatsheet
OpensMenu bool
}
Binding - a keybinding mapping a key and modifier to a handler. The keypress is only handled if the given view has focus, or handled globally if the view is ""
func (*Binding) GetDisplayStrings ¶ added in v0.3.0
GetDisplayStrings returns the display string of a file
type CherryPicking ¶ added in v0.22.0
type CherryPicking struct {
CherryPickedCommits []*models.Commit
// we only allow cherry picking from one context at a time, so you can't copy a commit from the local commits context and then also copy a commit in the reflog context
ContextKey ContextKey
}
func (*CherryPicking) Active ¶ added in v0.22.0
func (m *CherryPicking) Active() bool
type Context ¶ added in v0.22.0
type Context interface {
HandleFocus() error
HandleFocusLost() error
HandleRender() error
GetKind() ContextKind
GetViewName() string
GetWindowName() string
SetWindowName(string)
GetKey() ContextKey
SetParentContext(Context)
// we return a bool here to tell us whether or not the returned value just wraps a nil
GetParentContext() (Context, bool)
GetOptionsMap() map[string]string
}
type ContextKey ¶ added in v0.27.1
type ContextKey string
const ( STATUS_CONTEXT_KEY ContextKey = "status" FILES_CONTEXT_KEY ContextKey = "files" LOCAL_BRANCHES_CONTEXT_KEY ContextKey = "localBranches" REMOTES_CONTEXT_KEY ContextKey = "remotes" REMOTE_BRANCHES_CONTEXT_KEY ContextKey = "remoteBranches" TAGS_CONTEXT_KEY ContextKey = "tags" BRANCH_COMMITS_CONTEXT_KEY ContextKey = "commits" REFLOG_COMMITS_CONTEXT_KEY ContextKey = "reflogCommits" SUB_COMMITS_CONTEXT_KEY ContextKey = "subCommits" COMMIT_FILES_CONTEXT_KEY ContextKey = "commitFiles" STASH_CONTEXT_KEY ContextKey = "stash" MAIN_NORMAL_CONTEXT_KEY ContextKey = "normal" MAIN_MERGING_CONTEXT_KEY ContextKey = "merging" MAIN_PATCH_BUILDING_CONTEXT_KEY ContextKey = "patchBuilding" MAIN_STAGING_CONTEXT_KEY ContextKey = "staging" MENU_CONTEXT_KEY ContextKey = "menu" CREDENTIALS_CONTEXT_KEY ContextKey = "credentials" CONFIRMATION_CONTEXT_KEY ContextKey = "confirmation" SEARCH_CONTEXT_KEY ContextKey = "search" COMMIT_MESSAGE_CONTEXT_KEY ContextKey = "commitMessage" SUBMODULES_CONTEXT_KEY ContextKey = "submodules" SUGGESTIONS_CONTEXT_KEY ContextKey = "suggestions" )
type ContextKind ¶ added in v0.27.1
type ContextKind int
const ( SIDE_CONTEXT ContextKind = iota MAIN_CONTEXT TEMPORARY_POPUP PERSISTENT_POPUP )
type ContextManager ¶ added in v0.27.1
func NewContextManager ¶ added in v0.27.1
func NewContextManager(initialContext Context) ContextManager
type ContextTree ¶ added in v0.22.0
type ContextTree struct {
Status Context
Files *ListContext
Submodules *ListContext
Menu *ListContext
Branches *ListContext
Remotes *ListContext
RemoteBranches *ListContext
Tags *ListContext
BranchCommits *ListContext
CommitFiles *ListContext
ReflogCommits *ListContext
SubCommits *ListContext
Stash *ListContext
Suggestions *ListContext
Normal Context
Staging Context
PatchBuilding Context
Merging Context
Credentials Context
Confirmation Context
CommitMessage Context
Search Context
}
type CustomCommandObjects ¶ added in v0.23.1
type CustomCommandObjects struct {
SelectedLocalCommit *models.Commit
SelectedReflogCommit *models.Commit
SelectedSubCommit *models.Commit
SelectedFile *models.File
SelectedPath string
SelectedLocalBranch *models.Branch
SelectedRemoteBranch *models.RemoteBranch
SelectedRemote *models.Remote
SelectedTag *models.Tag
SelectedStashEntry *models.StashEntry
SelectedCommitFile *models.CommitFile
SelectedCommitFilePath string
CheckedOutBranch *models.Branch
PromptResponses []string
}
type Gui ¶
type Gui struct {
Log *logrus.Entry
GitCommand *commands.GitCommand
OSCommand *oscommands.OSCommand
// this is the state of the GUI for the current repo
State *guiState
// this is a mapping of repos to gui states, so that we can restore the original
// gui state when returning from a subrepo
RepoStateMap map[Repo]*guiState
Config config.AppConfigurer
Tr *i18n.TranslationSet
Updater *updates.Updater
Mutexes guiStateMutexes
// when you enter into a submodule we'll append the superproject's path to this array
// so that you can return to the superproject
RepoPathStack []string
// this tells us whether our views have been initially set up
ViewsSetup bool
Views Views
// contains filtered or unexported fields
}
Gui wraps the gocui Gui object which handles rendering and events
func NewGui ¶
func NewGui(log *logrus.Entry, gitCommand *commands.GitCommand, oSCommand *oscommands.OSCommand, tr *i18n.TranslationSet, config config.AppConfigurer, updater *updates.Updater, filterPath string, showRecentRepos bool) (*Gui, error)
for now the split view will always be on NewGui builds a new gui handler
func (*Gui) GetCustomCommandKeybindings ¶ added in v0.23.1
func (*Gui) GetInitialKeybindings ¶ added in v0.7.1
GetInitialKeybindings is a function.
func (*Gui) HandlePasteCommits ¶ added in v0.7.1
HandlePasteCommits begins a cherry-pick rebase with the commits the user has copied
func (*Gui) LBLCycleLine ¶ added in v0.23.1
func (*Gui) LBLSelectLine ¶ added in v0.23.1
func (*Gui) RenderCommitLength ¶ added in v0.2.2
func (gui *Gui) RenderCommitLength()
RenderCommitLength is a function.
func (*Gui) RunAndHandleError ¶ added in v0.27.1
RunAndHandleError
type IListPanelState ¶ added in v0.22.0
type ListContext ¶ added in v0.22.0
type ListContext struct {
ViewName string
ContextKey ContextKey
GetItemsLength func() int
GetDisplayStrings func() [][]string
OnFocus func() error
OnFocusLost func() error
OnClickSelectedItem func() error
OnGetOptionsMap func() map[string]string
// the boolean here tells us whether the item is nil. This is needed because you can't work it out on the calling end once the pointer is wrapped in an interface (unless you want to use reflection)
SelectedItem func() (ListItem, bool)
GetPanelState func() IListPanelState
Gui *Gui
ResetMainViewOriginOnFocus bool
Kind ContextKind
ParentContext Context
WindowName string
// contains filtered or unexported fields
}
func (*ListContext) GetKey ¶ added in v0.22.0
func (lc *ListContext) GetKey() ContextKey
func (*ListContext) GetKind ¶ added in v0.22.0
func (lc *ListContext) GetKind() ContextKind
func (*ListContext) GetOptionsMap ¶ added in v0.22.0
func (lc *ListContext) GetOptionsMap() map[string]string
func (*ListContext) GetParentContext ¶ added in v0.22.0
func (lc *ListContext) GetParentContext() (Context, bool)
func (*ListContext) GetSelectedItem ¶ added in v0.22.0
func (lc *ListContext) GetSelectedItem() (ListItem, bool)
func (*ListContext) GetSelectedItemId ¶ added in v0.22.0
func (lc *ListContext) GetSelectedItemId() string
func (*ListContext) GetViewName ¶ added in v0.22.0
func (lc *ListContext) GetViewName() string
func (*ListContext) GetWindowName ¶ added in v0.22.0
func (lc *ListContext) GetWindowName() string
func (*ListContext) HandleFocus ¶ added in v0.22.0
func (lc *ListContext) HandleFocus() error
func (*ListContext) HandleFocusLost ¶ added in v0.22.0
func (lc *ListContext) HandleFocusLost() error
func (*ListContext) HandleRender ¶ added in v0.22.0
func (lc *ListContext) HandleRender() error
func (*ListContext) OnRender ¶ added in v0.22.0
func (lc *ListContext) OnRender() error
OnFocus assumes that the content of the context has already been rendered to the view. OnRender is the function which actually renders the content to the view
func (*ListContext) SetParentContext ¶ added in v0.22.0
func (lc *ListContext) SetParentContext(c Context)
func (*ListContext) SetWindowName ¶ added in v0.22.0
func (lc *ListContext) SetWindowName(windowName string)
type ListItem ¶ added in v0.22.0
type ListItem interface {
// ID is a SHA when the item is a commit, a filename when the item is a file, 'stash@{4}' when it's a stash entry, 'my_branch' when it's a branch
ID() string
// Description is something we would show in a message e.g. '123as14: push blah' for a commit
Description() string
}
type Modes ¶ added in v0.22.0
type Modes struct {
Filtering filtering.Filtering
CherryPicking CherryPicking
Diffing Diffing
}
type PullFilesOptions ¶ added in v0.22.0
type ReflogActionKind ¶ added in v0.27.1
type ReflogActionKind int
const ( CHECKOUT ReflogActionKind = iota COMMIT REBASE CURRENT_REBASE )
type RefreshMode ¶ added in v0.27.1
type RefreshMode int
const ( SYNC RefreshMode = iota // wait until everything is done before returning ASYNC // return immediately, allowing each independent thing to update itself BLOCK_UI // wrap code in an update call to ensure UI updates all at once and keybindings aren't executed till complete )
type RefreshableView ¶ added in v0.27.1
type RefreshableView int
models/views that we can refresh
const ( COMMITS RefreshableView = iota BRANCHES FILES STASH REFLOG TAGS REMOTES STATUS SUBMODULES )
type SelectMode ¶ added in v0.27.1
type SelectMode int
these represent what select mode we're in
const ( LINE SelectMode = iota RANGE HUNK )
type StartupStage ¶ added in v0.27.1
type StartupStage int
startup stages so we don't need to load everything at once
const ( INITIAL StartupStage = iota COMPLETE )
type Views ¶ added in v0.27.1
type Views struct {
Status *gocui.View
Files *gocui.View
Branches *gocui.View
Commits *gocui.View
Stash *gocui.View
Main *gocui.View
Secondary *gocui.View
Options *gocui.View
Confirmation *gocui.View
Menu *gocui.View
Credentials *gocui.View
CommitMessage *gocui.View
CommitFiles *gocui.View
Information *gocui.View
AppStatus *gocui.View
Search *gocui.View
SearchPrefix *gocui.View
Limit *gocui.View
Suggestions *gocui.View
}
type WindowMaximisation ¶ added in v0.27.1
type WindowMaximisation int
screen sizing determines how much space your selected window takes up (window as in panel, not your terminal's window). Sometimes you want a bit more space to see the contents of a panel, and this keeps track of how much maximisation you've set
const ( SCREEN_NORMAL WindowMaximisation = iota SCREEN_HALF SCREEN_FULL )
Source Files
¶
- app_status_manager.go
- arrangement.go
- branches_panel.go
- cherry_picking.go
- commit_files_panel.go
- commit_message_panel.go
- commits_panel.go
- confirmation_panel.go
- context.go
- credentials_panel.go
- custom_commands.go
- diffing.go
- discard_changes_menu_panel.go
- editors.go
- errors.go
- file_watching.go
- files_panel.go
- filtering.go
- filtering_menu_panel.go
- git_flow.go
- global_handlers.go
- gui.go
- keybindings.go
- layout.go
- line_by_line_panel.go
- list_context.go
- main_panels.go
- menu_panel.go
- merge_panel.go
- modes.go
- options_menu_panel.go
- patch_building_panel.go
- patch_options_panel.go
- pty.go
- quitting.go
- rebase_options_panel.go
- recent_repos_panel.go
- recording.go
- reflog_panel.go
- remote_branches_panel.go
- remotes_panel.go
- reset_menu_panel.go
- searching.go
- side_window.go
- staging_panel.go
- stash_panel.go
- status_panel.go
- sub_commits_panel.go
- submodules_panel.go
- suggestions_panel.go
- tags_panel.go
- tasks_adapter.go
- undoing.go
- updates.go
- view_helpers.go
- window.go
- workspace_reset_options_panel.go