Documentation
¶
Overview ¶
Package app is laziergit's window: lazygit's functionality, through package core, in MyGo's native UI.
Index ¶
- func SaveSettings(dir string, s Settings) error
- type App
- func (a *App) AutoFetch()
- func (a *App) Busy() bool
- func (a *App) ChangedOnDisk()
- func (a *App) Close()
- func (a *App) Notice(title, desc string)
- func (a *App) Open(dir string, done func(error))
- func (a *App) Repo() *core.Repo
- func (a *App) SettingsChanged()
- func (a *App) ShowSection(name string)
- func (a *App) View(c *ui.Context)
- type Copies
- type Host
- type Settings
- type SettingsPane
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SaveSettings ¶ added in v0.5.0
SaveSettings writes the settings in dir, atomically.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the state of a window on a repository.
func (*App) AutoFetch ¶ added in v0.5.0
func (a *App) AutoFetch()
AutoFetch fetches in the background, as the settings ask every few minutes: quietly, and not while the window has git busy or a dialog up.
func (*App) ChangedOnDisk ¶
func (a *App) ChangedOnDisk()
ChangedOnDisk refreshes after the work tree or the repository changed outside the app. It skips changes the app's own commands and refreshes just made, and leaves a refresh running to finish.
func (*App) Close ¶
func (a *App) Close()
Close closes the repository, as the window closes: git waiting on a credential is answered, so that it stops, and the repository closes once its command ends, off the UI thread.
func (*App) Open ¶
Open opens the repository dir is in, off the UI thread, and loads it. done, when set, is told how it went, on the UI thread.
func (*App) SettingsChanged ¶ added in v0.5.0
func (a *App) SettingsChanged()
SettingsChanged follows settings changed: the repository's commands and, for the diffs and the log, a load again.
func (*App) ShowSection ¶
ShowSection shows a section of the sidebar: changes, history, branches or stash.
type Copies ¶ added in v0.5.2
type Copies struct {
// contains filtered or unexported fields
}
Copies are the commits copied to cherry-pick, which every window of a repository and of its worktrees shares: their commits are the same objects, so a window pastes what another copied.
type Host ¶
type Host struct {
// Post runs fn on the UI thread and rebuilds the view.
Post func(fn func())
// Go runs fn off the UI thread.
Go func(fn func())
// OpenRepository asks for a repository to open, and opens it: in this
// window while it has none, in a window of its own otherwise.
OpenRepository func()
// Opened is told of the repository the window opened.
Opened func(r *core.Repo)
// Idle, when set, is told when the window's actions are all done.
Idle func()
// Recent lists the repositories opened lately, newest first, and
// OpenRecent opens one, as OpenRepository does.
Recent func() []string
OpenRecent func(path string)
// Watch, when set, watches the work tree of a repository opened, to
// call App.ChangedOnDisk on the UI thread, in place of the last one.
Watch func(path string)
// Settings are the app's, shared by its windows, nil for the
// defaults; OpenSettings shows the Settings window.
Settings *Settings
OpenSettings func()
// Copies, when set, gives the commits copied to cherry-pick of the
// repository whose worktrees share the git directory commonDir, which
// its windows share; CopiesChanged has those windows show them anew.
Copies func(commonDir string) *Copies
CopiesChanged func()
// Main, when set, runs fn on the UI thread whether or not the window
// is still open, for what is the app's rather than the window's.
Main func(fn func())
}
Host is what the app needs of its window: to run a function on the UI thread and draw again, and to run work off it.
type Settings ¶ added in v0.5.0
type Settings struct {
// Theme is "system", "light" or "dark".
Theme string `json:"theme"`
// ShowKeyHints shows the status bar of keys; ShowTabShortcuts the
// keys of the sidebar's sections; RestoreSession opens the last
// session's windows at launch.
ShowKeyHints bool `json:"showKeyHints"`
ShowTabShortcuts bool `json:"showTabShortcuts"`
RestoreSession bool `json:"restoreSession"`
// SplitDiff shows diffs side by side, unless a window chose otherwise.
SplitDiff bool `json:"splitDiff"`
DiffContext int `json:"diffContext"`
CommitLimit int `json:"commitLimit"`
// FetchMinutes fetches in the background that often, 0 never.
FetchMinutes int `json:"fetchMinutes"`
SignOff bool `json:"signOff"`
ConfirmPush bool `json:"confirmPush"`
MainBranches []string `json:"mainBranches"`
}
Settings are the app's, which every window follows, kept in settings.json in the app's config directory.
func DefaultSettings ¶ added in v0.5.0
func DefaultSettings() Settings
DefaultSettings are the settings of a new install, as the app was.
func LoadSettings ¶ added in v0.5.0
LoadSettings reads the settings in dir, the defaults for those it lacks, or all of them when there are none yet.
type SettingsPane ¶ added in v0.5.0
type SettingsPane struct {
S *Settings
Changed func()
// contains filtered or unexported fields
}
SettingsPane is the Settings window: the settings s, which changed is told of after each change, on the UI thread.
func (*SettingsPane) View ¶ added in v0.5.0
func (p *SettingsPane) View(c *ui.Context)
View builds the Settings window.