Documentation ¶
Index ¶
- Constants
- Variables
- func GetKeyDisplay(key interface{}) string
- func NewFileWatcher(log *logrus.Entry) *fileWatcher
- type BasicContext
- func (c BasicContext) GetKey() string
- func (c BasicContext) GetKind() int
- 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 ContextTree
- type Diffing
- type Filtering
- type Gui
- func (gui *Gui) GenerateSentinelErrors()
- func (gui *Gui) GetInitialKeybindings() []*Binding
- func (gui *Gui) HandlePasteCommits() error
- func (gui *Gui) PrepareSubProcess(commands ...string)
- func (gui *Gui) RenderCommitLength()
- func (gui *Gui) Run() error
- func (gui *Gui) RunWithSubprocesses() error
- func (gui *Gui) WithWaitingStatus(name string, f func() error) error
- type IListPanelState
- type ListContext
- func (lc *ListContext) GetKey() string
- func (lc *ListContext) GetKind() int
- 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 RemotesContextNode
- type SentinelErrors
- type SimpleContextNode
- type Teml
Constants ¶
const ( SIDE_CONTEXT int = iota MAIN_CONTEXT TEMPORARY_POPUP PERSISTENT_POPUP )
const ( STATUS_CONTEXT_KEY = "status" FILES_CONTEXT_KEY = "files" LOCAL_BRANCHES_CONTEXT_KEY = "localBranches" REMOTES_CONTEXT_KEY = "remotes" REMOTE_BRANCHES_CONTEXT_KEY = "remoteBranches" TAGS_CONTEXT_KEY = "tags" BRANCH_COMMITS_CONTEXT_KEY = "commits" REFLOG_COMMITS_CONTEXT_KEY = "reflogCommits" SUB_COMMITS_CONTEXT_KEY = "subCommits" COMMIT_FILES_CONTEXT_KEY = "commitFiles" STASH_CONTEXT_KEY = "stash" MAIN_NORMAL_CONTEXT_KEY = "normal" MAIN_MERGING_CONTEXT_KEY = "merging" MAIN_PATCH_BUILDING_CONTEXT_KEY = "patchBuilding" MAIN_STAGING_CONTEXT_KEY = "staging" MENU_CONTEXT_KEY = "menu" CREDENTIALS_CONTEXT_KEY = "credentials" CONFIRMATION_CONTEXT_KEY = "confirmation" SEARCH_CONTEXT_KEY = "confirmation" COMMIT_MESSAGE_CONTEXT_KEY = "commitMessage" )
const ( SCREEN_NORMAL int = iota SCREEN_HALF SCREEN_FULL )
const ( INITIAL = iota COMPLETE )
startup stages so we don't need to load everything at once
const ( LINE = iota RANGE HUNK )
these represent what select mode we're in
const ( RENDER_STRING = iota RENDER_STRING_WITHOUT_SCROLL RUN_FUNCTION RUN_COMMAND RUN_PTY )
constants for updateTask's kind field
const ( CHECKOUT = iota COMMIT REBASE CURRENT_REBASE )
const ( COMMITS = iota BRANCHES FILES STASH REFLOG TAGS REMOTES STATUS )
models/views that we can refresh
const ( SYNC = 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 )
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 = 1
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
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 int Key string ViewName string }
func (BasicContext) GetKey ¶ added in v0.22.0
func (c BasicContext) GetKey() string
func (BasicContext) GetKind ¶ added in v0.22.0
func (c BasicContext) GetKind() int
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(*gocui.Gui, *gocui.View) error Key interface{} // FIXME: find out how to get `gocui.Key | rune` Modifier gocui.Modifier Description string Alternative string }
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 []*commands.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 string }
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() int GetViewName() string GetWindowName() string SetWindowName(string) GetKey() string 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 ContextTree ¶ added in v0.22.0
type ContextTree struct { Status SimpleContextNode Files SimpleContextNode Menu SimpleContextNode Branches SimpleContextNode Remotes RemotesContextNode Tags SimpleContextNode BranchCommits SimpleContextNode CommitFiles SimpleContextNode ReflogCommits SimpleContextNode SubCommits SimpleContextNode Stash SimpleContextNode Normal SimpleContextNode Staging SimpleContextNode PatchBuilding SimpleContextNode Merging SimpleContextNode Credentials SimpleContextNode Confirmation SimpleContextNode CommitMessage SimpleContextNode Search SimpleContextNode }
type Filtering ¶ added in v0.22.0
type Filtering struct {
Path string // the filename that gets passed to git log
}
type Gui ¶
type Gui struct { Log *logrus.Entry GitCommand *commands.GitCommand OSCommand *commands.OSCommand SubProcess *exec.Cmd State *guiState Config config.AppConfigurer Tr *i18n.Localizer Errors SentinelErrors Updater *updates.Updater Contexts ContextTree ViewTabContextMap map[string][]tabContext // 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 *commands.OSCommand, tr *i18n.Localizer, 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) GenerateSentinelErrors ¶ added in v0.1.62
func (gui *Gui) GenerateSentinelErrors()
GenerateSentinelErrors makes the sentinel errors for the gui. We're defining it here because we can't do package-scoped errors with localization, and also because it seems like package-scoped variables are bad in general https://dave.cheney.net/2017/06/11/go-without-package-scoped-variables In the future it would be good to implement some of the recommendations of that article. For now, if we don't need an error to be a sentinel, we will just define it inline. This has implications for error messages that pop up everywhere in that we'll be duplicating the default values. We may need to look at having a default localisation bundle defined, and just using keys-only when localising things in the code.
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) PrepareSubProcess ¶
PrepareSubProcess - prepare a subprocess for execution and tell the gui to switch to it
func (*Gui) RenderCommitLength ¶ added in v0.2.2
func (gui *Gui) RenderCommitLength()
RenderCommitLength is a function.
func (*Gui) RunWithSubprocesses ¶
RunWithSubprocesses loops, instantiating a new gocui.Gui with each iteration if the error returned from a run is a ErrSubProcess, it runs the subprocess otherwise it handles the error, possibly by quitting the application
type IListPanelState ¶ added in v0.22.0
type ListContext ¶ added in v0.22.0
type ListContext struct { ViewName string ContextKey string 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 int ParentContext Context WindowName string // contains filtered or unexported fields }
func (*ListContext) GetKey ¶ added in v0.22.0
func (lc *ListContext) GetKey() string
func (*ListContext) GetKind ¶ added in v0.22.0
func (lc *ListContext) GetKind() int
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 CherryPicking CherryPicking Diffing Diffing }
type PullFilesOptions ¶ added in v0.22.0
type RemotesContextNode ¶ added in v0.22.0
type RemotesContextNode struct { Context Context Branches SimpleContextNode }
type SentinelErrors ¶ added in v0.1.62
type SentinelErrors struct { ErrSubProcess error ErrNoFiles error ErrSwitchRepo error ErrRestart error }
SentinelErrors are the errors that have special meaning and need to be checked by calling functions. The less of these, the better
type SimpleContextNode ¶ added in v0.22.0
type SimpleContextNode struct {
Context Context
}
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
- diffing.go
- discard_changes_menu_panel.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
- 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
- tags_panel.go
- tasks_adapter.go
- undoing.go
- updates.go
- view_helpers.go
- window.go
- workspace_reset_options_panel.go