mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-24 05:36:19 +02:00
Add comments in user config struct (#3040)
This commit is contained in:
commit
e997d1ae5d
@ -20,7 +20,11 @@ linters:
|
|||||||
linters-settings:
|
linters-settings:
|
||||||
exhaustive:
|
exhaustive:
|
||||||
default-signifies-exhaustive: true
|
default-signifies-exhaustive: true
|
||||||
|
staticcheck:
|
||||||
|
# SA1019 is for checking that we're not using fields marked as deprecated
|
||||||
|
# in a comment. It decides this in a loose way so I'm silencing it. Also because
|
||||||
|
# it's tripping on our own structs.
|
||||||
|
checks: ["all", "-SA1019"]
|
||||||
nakedret:
|
nakedret:
|
||||||
# the gods will judge me but I just don't like naked returns at all
|
# the gods will judge me but I just don't like naked returns at all
|
||||||
max-func-lines: 0
|
max-func-lines: 0
|
||||||
|
@ -5,131 +5,252 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type UserConfig struct {
|
type UserConfig struct {
|
||||||
Gui GuiConfig `yaml:"gui"`
|
// Config relating to the Lazygit UI
|
||||||
Git GitConfig `yaml:"git"`
|
Gui GuiConfig `yaml:"gui"`
|
||||||
Update UpdateConfig `yaml:"update"`
|
// Config relating to git
|
||||||
Refresher RefresherConfig `yaml:"refresher"`
|
Git GitConfig `yaml:"git"`
|
||||||
ConfirmOnQuit bool `yaml:"confirmOnQuit"`
|
// Periodic update checks
|
||||||
QuitOnTopLevelReturn bool `yaml:"quitOnTopLevelReturn"`
|
Update UpdateConfig `yaml:"update"`
|
||||||
Keybinding KeybindingConfig `yaml:"keybinding"`
|
// Background refreshes
|
||||||
// OS determines what defaults are set for opening files and links
|
Refresher RefresherConfig `yaml:"refresher"`
|
||||||
OS OSConfig `yaml:"os,omitempty"`
|
// If true, show a confirmation popup before quitting Lazygit
|
||||||
DisableStartupPopups bool `yaml:"disableStartupPopups"`
|
ConfirmOnQuit bool `yaml:"confirmOnQuit"`
|
||||||
CustomCommands []CustomCommand `yaml:"customCommands"`
|
// If true, exit Lazygit when the user presses escape in a context where there is nothing to cancel/close
|
||||||
Services map[string]string `yaml:"services"`
|
QuitOnTopLevelReturn bool `yaml:"quitOnTopLevelReturn"`
|
||||||
NotARepository string `yaml:"notARepository"`
|
// Keybindings
|
||||||
PromptToReturnFromSubprocess bool `yaml:"promptToReturnFromSubprocess"`
|
Keybinding KeybindingConfig `yaml:"keybinding"`
|
||||||
|
// Config relating to things outside of Lazygit like how files are opened, copying to clipboard, etc
|
||||||
|
OS OSConfig `yaml:"os,omitempty"`
|
||||||
|
// If true, don't display introductory popups upon opening Lazygit.
|
||||||
|
// Lazygit sets this to true upon first runninng the program so that you don't see introductory popups every time you open the program.
|
||||||
|
DisableStartupPopups bool `yaml:"disableStartupPopups"`
|
||||||
|
// User-configured commands that can be invoked from within Lazygit
|
||||||
|
CustomCommands []CustomCommand `yaml:"customCommands"`
|
||||||
|
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-pull-request-urls
|
||||||
|
Services map[string]string `yaml:"services"`
|
||||||
|
// What to do when opening Lazygit outside of a git repo.
|
||||||
|
// - 'prompt': (default) ask whether to initialize a new repo or open in the most recent repo
|
||||||
|
// - 'create': initialize a new repo
|
||||||
|
// - 'skip': open most recent repo
|
||||||
|
// - 'quit': exit Lazygit
|
||||||
|
NotARepository string `yaml:"notARepository"`
|
||||||
|
// If true, display a confirmation when subprocess terminates. This allows you to view the output of the subprocess before returning to Lazygit.
|
||||||
|
PromptToReturnFromSubprocess bool `yaml:"promptToReturnFromSubprocess"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RefresherConfig struct {
|
type RefresherConfig struct {
|
||||||
|
// File/submodule refresh interval in seconds.
|
||||||
|
// Auto-refresh can be disabled via option 'git.autoRefresh'.
|
||||||
RefreshInterval int `yaml:"refreshInterval"`
|
RefreshInterval int `yaml:"refreshInterval"`
|
||||||
FetchInterval int `yaml:"fetchInterval"`
|
// Re-fetch interval in seconds.
|
||||||
|
// Auto-fetch can be disabled via option 'git.autoFetch'.
|
||||||
|
FetchInterval int `yaml:"fetchInterval"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GuiConfig struct {
|
type GuiConfig struct {
|
||||||
AuthorColors map[string]string `yaml:"authorColors"`
|
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-author-color
|
||||||
BranchColors map[string]string `yaml:"branchColors"`
|
AuthorColors map[string]string `yaml:"authorColors"`
|
||||||
ScrollHeight int `yaml:"scrollHeight"`
|
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-branch-color
|
||||||
ScrollPastBottom bool `yaml:"scrollPastBottom"`
|
BranchColors map[string]string `yaml:"branchColors"`
|
||||||
ScrollOffMargin int `yaml:"scrollOffMargin"`
|
// The number of lines you scroll by when scrolling the main window
|
||||||
ScrollOffBehavior string `yaml:"scrollOffBehavior"`
|
ScrollHeight int `yaml:"scrollHeight"`
|
||||||
MouseEvents bool `yaml:"mouseEvents"`
|
// If true, allow scrolling past the bottom of the content in the main window
|
||||||
SkipDiscardChangeWarning bool `yaml:"skipDiscardChangeWarning"`
|
ScrollPastBottom bool `yaml:"scrollPastBottom"`
|
||||||
SkipStashWarning bool `yaml:"skipStashWarning"`
|
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#scroll-off-margin
|
||||||
SidePanelWidth float64 `yaml:"sidePanelWidth"`
|
ScrollOffMargin int `yaml:"scrollOffMargin"`
|
||||||
ExpandFocusedSidePanel bool `yaml:"expandFocusedSidePanel"`
|
// One of: 'margin' (default) | 'jump'
|
||||||
MainPanelSplitMode string `yaml:"mainPanelSplitMode"`
|
ScrollOffBehavior string `yaml:"scrollOffBehavior"`
|
||||||
Language string `yaml:"language"`
|
// If true, capture mouse events.
|
||||||
TimeFormat string `yaml:"timeFormat"`
|
// When mouse events are captured, it's a little harder to select text: e.g. requiring you to hold the option key when on macOS.
|
||||||
ShortTimeFormat string `yaml:"shortTimeFormat"`
|
MouseEvents bool `yaml:"mouseEvents"`
|
||||||
Theme ThemeConfig `yaml:"theme"`
|
// If true, do not show a warning when discarding changes in the staging view.
|
||||||
CommitLength CommitLengthConfig `yaml:"commitLength"`
|
SkipDiscardChangeWarning bool `yaml:"skipDiscardChangeWarning"`
|
||||||
SkipNoStagedFilesWarning bool `yaml:"skipNoStagedFilesWarning"`
|
// If true, do not show warning when applying/popping the stash
|
||||||
ShowListFooter bool `yaml:"showListFooter"`
|
SkipStashWarning bool `yaml:"skipStashWarning"`
|
||||||
ShowFileTree bool `yaml:"showFileTree"`
|
// If true, do not show a warning when attempting to commit without any staged files; instead stage all unstaged files.
|
||||||
ShowRandomTip bool `yaml:"showRandomTip"`
|
SkipNoStagedFilesWarning bool `yaml:"skipNoStagedFilesWarning"`
|
||||||
ShowCommandLog bool `yaml:"showCommandLog"`
|
// If true, do not show a warning when rewording a commit via an external editor
|
||||||
ShowBottomLine bool `yaml:"showBottomLine"`
|
SkipRewordInEditorWarning bool `yaml:"skipRewordInEditorWarning"`
|
||||||
ShowPanelJumps bool `yaml:"showPanelJumps"`
|
// Fraction of the total screen width to use for the left side section. You may want to pick a small number (e.g. 0.2) if you're using a narrow screen, so that you can see more of the main section.
|
||||||
ShowIcons bool `yaml:"showIcons"`
|
// Number from 0 to 1.0.
|
||||||
NerdFontsVersion string `yaml:"nerdFontsVersion"`
|
SidePanelWidth float64 `yaml:"sidePanelWidth"`
|
||||||
ShowBranchCommitHash bool `yaml:"showBranchCommitHash"`
|
// If true, increase the height of the focused side window; creating an accordion effect.
|
||||||
CommandLogSize int `yaml:"commandLogSize"`
|
ExpandFocusedSidePanel bool `yaml:"expandFocusedSidePanel"`
|
||||||
SplitDiff string `yaml:"splitDiff"`
|
// Sometimes the main window is split in two (e.g. when the selected file has both staged and unstaged changes). This setting controls how the two sections are split.
|
||||||
SkipRewordInEditorWarning bool `yaml:"skipRewordInEditorWarning"`
|
// Options are:
|
||||||
WindowSize string `yaml:"windowSize"`
|
// - 'horizontal': split the window horizontally
|
||||||
Border string `yaml:"border"`
|
// - 'vertical': split the window vertically
|
||||||
AnimateExplosion bool `yaml:"animateExplosion"`
|
// - 'flexible': (default) split the window horizontally if the window is wide enough, otherwise split vertically
|
||||||
|
MainPanelSplitMode string `yaml:"mainPanelSplitMode"`
|
||||||
|
// One of 'auto' (default) | 'en' | 'zh-CN' | 'zh-TW' | 'pl' | 'nl' | 'ja' | 'ko' | 'ru'
|
||||||
|
Language string `yaml:"language"`
|
||||||
|
// Format used when displaying time e.g. commit time.
|
||||||
|
// Uses Go's time format syntax: https://pkg.go.dev/time#Time.Format
|
||||||
|
TimeFormat string `yaml:"timeFormat"`
|
||||||
|
// Format used when displaying time if the time is less than 24 hours ago.
|
||||||
|
// Uses Go's time format syntax: https://pkg.go.dev/time#Time.Format
|
||||||
|
ShortTimeFormat string `yaml:"shortTimeFormat"`
|
||||||
|
// Config relating to colors and styles.
|
||||||
|
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#color-attributes
|
||||||
|
Theme ThemeConfig `yaml:"theme"`
|
||||||
|
// Config relating to the commit length indicator
|
||||||
|
CommitLength CommitLengthConfig `yaml:"commitLength"`
|
||||||
|
// If true, show the '5 of 20' footer at the bottom of list views
|
||||||
|
ShowListFooter bool `yaml:"showListFooter"`
|
||||||
|
// If true, display the files in the file views as a tree. If false, display the files as a flat list.
|
||||||
|
// This can be toggled from within Lazygit with the '~' key, but that will not change the default.
|
||||||
|
ShowFileTree bool `yaml:"showFileTree"`
|
||||||
|
// If true, show a random tip in the command log when Lazygit starts
|
||||||
|
ShowRandomTip bool `yaml:"showRandomTip"`
|
||||||
|
// If true, show the command log
|
||||||
|
ShowCommandLog bool `yaml:"showCommandLog"`
|
||||||
|
// If true, show the bottom line that contains keybinding info and useful buttons. If false, this line will be hidden except to display a loader for an in-progress action.
|
||||||
|
ShowBottomLine bool `yaml:"showBottomLine"`
|
||||||
|
// If true, show jump-to-window keybindings in window titles.
|
||||||
|
ShowPanelJumps bool `yaml:"showPanelJumps"`
|
||||||
|
// Deprecated: use nerdFontsVersion instead
|
||||||
|
ShowIcons bool `yaml:"showIcons"`
|
||||||
|
// Nerd fonts version to use.
|
||||||
|
// One of: '2' | '3' | empty string (default)
|
||||||
|
// If empty, do not show icons.
|
||||||
|
NerdFontsVersion string `yaml:"nerdFontsVersion"`
|
||||||
|
// If true, show commit hashes alongside branch names in the branches view.
|
||||||
|
ShowBranchCommitHash bool `yaml:"showBranchCommitHash"`
|
||||||
|
// Height of the command log view
|
||||||
|
CommandLogSize int `yaml:"commandLogSize"`
|
||||||
|
// Whether to split the main window when viewing file changes.
|
||||||
|
// One of: 'auto' | 'always'
|
||||||
|
// If 'auto', only split the main window when a file has both staged and unstaged changes
|
||||||
|
SplitDiff string `yaml:"splitDiff"`
|
||||||
|
// Default size for focused window. Window size can be changed from within Lazygit with '+' and '_' (but this won't change the default).
|
||||||
|
// One of: 'normal' (default) | 'half' | 'full'
|
||||||
|
WindowSize string `yaml:"windowSize"`
|
||||||
|
// Window border style.
|
||||||
|
// One of 'rounded' (default) | 'single' | 'double' | 'hidden'
|
||||||
|
Border string `yaml:"border"`
|
||||||
|
// If true, show a seriously epic explosion animation when nuking the working tree.
|
||||||
|
AnimateExplosion bool `yaml:"animateExplosion"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ThemeConfig struct {
|
type ThemeConfig struct {
|
||||||
ActiveBorderColor []string `yaml:"activeBorderColor"`
|
// Border color of focused window
|
||||||
InactiveBorderColor []string `yaml:"inactiveBorderColor"`
|
ActiveBorderColor []string `yaml:"activeBorderColor"`
|
||||||
|
// Border color of non-focused windows
|
||||||
|
InactiveBorderColor []string `yaml:"inactiveBorderColor"`
|
||||||
|
// Border color of focused window when searching in that window
|
||||||
SearchingActiveBorderColor []string `yaml:"searchingActiveBorderColor"`
|
SearchingActiveBorderColor []string `yaml:"searchingActiveBorderColor"`
|
||||||
OptionsTextColor []string `yaml:"optionsTextColor"`
|
// Color of keybindings help text in the bottom line
|
||||||
SelectedLineBgColor []string `yaml:"selectedLineBgColor"`
|
OptionsTextColor []string `yaml:"optionsTextColor"`
|
||||||
SelectedRangeBgColor []string `yaml:"selectedRangeBgColor"`
|
// Background color of selected line.
|
||||||
CherryPickedCommitBgColor []string `yaml:"cherryPickedCommitBgColor"`
|
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#highlighting-the-selected-line
|
||||||
CherryPickedCommitFgColor []string `yaml:"cherryPickedCommitFgColor"`
|
SelectedLineBgColor []string `yaml:"selectedLineBgColor"`
|
||||||
MarkedBaseCommitBgColor []string `yaml:"markedBaseCommitBgColor"`
|
// Background color of selected range
|
||||||
MarkedBaseCommitFgColor []string `yaml:"markedBaseCommitFgColor"`
|
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#highlighting-the-selected-line
|
||||||
UnstagedChangesColor []string `yaml:"unstagedChangesColor"`
|
SelectedRangeBgColor []string `yaml:"selectedRangeBgColor"`
|
||||||
DefaultFgColor []string `yaml:"defaultFgColor"`
|
// Foreground color of copied commit
|
||||||
|
CherryPickedCommitFgColor []string `yaml:"cherryPickedCommitFgColor"`
|
||||||
|
// Background color of copied commit
|
||||||
|
CherryPickedCommitBgColor []string `yaml:"cherryPickedCommitBgColor"`
|
||||||
|
// Foreground color of marked base commit (for rebase)
|
||||||
|
MarkedBaseCommitFgColor []string `yaml:"markedBaseCommitFgColor"`
|
||||||
|
// Background color of marked base commit (for rebase)
|
||||||
|
MarkedBaseCommitBgColor []string `yaml:"markedBaseCommitBgColor"`
|
||||||
|
// Color for file with unstaged changes
|
||||||
|
UnstagedChangesColor []string `yaml:"unstagedChangesColor"`
|
||||||
|
// Default text color
|
||||||
|
DefaultFgColor []string `yaml:"defaultFgColor"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CommitLengthConfig struct {
|
type CommitLengthConfig struct {
|
||||||
|
// If true, show an indicator of commit message length
|
||||||
Show bool `yaml:"show"`
|
Show bool `yaml:"show"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GitConfig struct {
|
type GitConfig struct {
|
||||||
Paging PagingConfig `yaml:"paging"`
|
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md
|
||||||
Commit CommitConfig `yaml:"commit"`
|
Paging PagingConfig `yaml:"paging"`
|
||||||
Merging MergingConfig `yaml:"merging"`
|
// Config relating to committing
|
||||||
MainBranches []string `yaml:"mainBranches"`
|
Commit CommitConfig `yaml:"commit"`
|
||||||
SkipHookPrefix string `yaml:"skipHookPrefix"`
|
// Config relating to merging
|
||||||
AutoFetch bool `yaml:"autoFetch"`
|
Merging MergingConfig `yaml:"merging"`
|
||||||
AutoRefresh bool `yaml:"autoRefresh"`
|
// list of branches that are considered 'main' branches, used when displaying commits
|
||||||
FetchAll bool `yaml:"fetchAll"`
|
MainBranches []string `yaml:"mainBranches"`
|
||||||
BranchLogCmd string `yaml:"branchLogCmd"`
|
// Prefix to use when skipping hooks. E.g. if set to 'WIP', then pre-commit hooks will be skipped when the commit message starts with 'WIP'
|
||||||
AllBranchesLogCmd string `yaml:"allBranchesLogCmd"`
|
SkipHookPrefix string `yaml:"skipHookPrefix"`
|
||||||
OverrideGpg bool `yaml:"overrideGpg"`
|
// If true, periodically fetch from remote
|
||||||
DisableForcePushing bool `yaml:"disableForcePushing"`
|
AutoFetch bool `yaml:"autoFetch"`
|
||||||
CommitPrefixes map[string]CommitPrefixConfig `yaml:"commitPrefixes"`
|
// If true, periodically refresh files and submodules
|
||||||
// this should really be under 'gui', not 'git'
|
AutoRefresh bool `yaml:"autoRefresh"`
|
||||||
ParseEmoji bool `yaml:"parseEmoji"`
|
// If true, pass the --all arg to git fetch
|
||||||
Log LogConfig `yaml:"log"`
|
FetchAll bool `yaml:"fetchAll"`
|
||||||
|
// Command used when displaying the current branch git log in the main window
|
||||||
|
BranchLogCmd string `yaml:"branchLogCmd"`
|
||||||
|
// Command used to display git log of all branches in the main window
|
||||||
|
AllBranchesLogCmd string `yaml:"allBranchesLogCmd"`
|
||||||
|
// If true, do not spawn a separate process when using GPG
|
||||||
|
OverrideGpg bool `yaml:"overrideGpg"`
|
||||||
|
// If true, do not allow force pushes
|
||||||
|
DisableForcePushing bool `yaml:"disableForcePushing"`
|
||||||
|
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix
|
||||||
|
CommitPrefixes map[string]CommitPrefixConfig `yaml:"commitPrefixes"`
|
||||||
|
// If true, parse emoji strings in commit messages e.g. render :rocket: as 🚀
|
||||||
|
// (This should really be under 'gui', not 'git')
|
||||||
|
ParseEmoji bool `yaml:"parseEmoji"`
|
||||||
|
// Config for showing the log in the commits view
|
||||||
|
Log LogConfig `yaml:"log"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PagingConfig struct {
|
type PagingConfig struct {
|
||||||
ColorArg string `yaml:"colorArg"`
|
// Value of the --color arg in the git diff command. Some pagers want this to be set to 'always' and some want it set to 'never'
|
||||||
Pager string `yaml:"pager"`
|
ColorArg string `yaml:"colorArg"`
|
||||||
UseConfig bool `yaml:"useConfig"`
|
// e.g.
|
||||||
|
// diff-so-fancy
|
||||||
|
// delta --dark --paging=never
|
||||||
|
// ydiff -p cat -s --wrap --width={{columnWidth}}
|
||||||
|
Pager string `yaml:"pager"`
|
||||||
|
// If true, Lazygit will use whatever pager is specified in `$GIT_PAGER`, `$PAGER`, or your *git config*. If the pager ends with something like ` | less` we will strip that part out, because less doesn't play nice with our rendering approach. If the custom pager uses less under the hood, that will also break rendering (hence the `--paging=never` flag for the `delta` pager).
|
||||||
|
UseConfig bool `yaml:"useConfig"`
|
||||||
|
// e.g. 'difft --color=always'
|
||||||
ExternalDiffCommand string `yaml:"externalDiffCommand"`
|
ExternalDiffCommand string `yaml:"externalDiffCommand"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CommitConfig struct {
|
type CommitConfig struct {
|
||||||
|
// If true, pass '--signoff' flag when committing
|
||||||
SignOff bool `yaml:"signOff"`
|
SignOff bool `yaml:"signOff"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MergingConfig struct {
|
type MergingConfig struct {
|
||||||
ManualCommit bool `yaml:"manualCommit"`
|
// If true, run merges in a subprocess so that if a commit message is required, Lazygit will not hang
|
||||||
Args string `yaml:"args"`
|
// Only applicable to unix users.
|
||||||
|
ManualCommit bool `yaml:"manualCommit"`
|
||||||
|
// Extra args passed to `git merge`, e.g. --no-ff
|
||||||
|
Args string `yaml:"args"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type LogConfig struct {
|
type LogConfig struct {
|
||||||
Order string `yaml:"order"` // one of date-order, author-date-order, topo-order
|
// One of: 'date-order' | 'author-date-order' | 'topo-order'
|
||||||
ShowGraph string `yaml:"showGraph"` // one of always, never, when-maximised
|
// 'topo-order' makes it easier to read the git log graph, but commits may not
|
||||||
ShowWholeGraph bool `yaml:"showWholeGraph"`
|
// appear chronologically. See https://git-scm.com/docs/
|
||||||
|
Order string `yaml:"order"`
|
||||||
|
// This determines whether the git graph is rendered in the commits panel
|
||||||
|
// One of 'always' | 'never' 'when-maximised'
|
||||||
|
ShowGraph string `yaml:"showGraph"`
|
||||||
|
// displays the whole git graph by default in the commits view (equivalent to passing the `--all` argument to `git log`)
|
||||||
|
ShowWholeGraph bool `yaml:"showWholeGraph"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CommitPrefixConfig struct {
|
type CommitPrefixConfig struct {
|
||||||
|
// pattern to match on. E.g. for 'feature/AB-123' to match on the AB-123 use "^\\w+\\/(\\w+-\\w+).*"
|
||||||
Pattern string `yaml:"pattern"`
|
Pattern string `yaml:"pattern"`
|
||||||
|
// Replace directive. E.g. for 'feature/AB-123' to start the commit message with 'AB-123 ' use "[$1] "
|
||||||
Replace string `yaml:"replace"`
|
Replace string `yaml:"replace"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateConfig struct {
|
type UpdateConfig struct {
|
||||||
|
// One of: 'prompt' (default) | 'background' | 'never'
|
||||||
Method string `yaml:"method"`
|
Method string `yaml:"method"`
|
||||||
Days int64 `yaml:"days"`
|
// Period in days between update checks
|
||||||
|
Days int64 `yaml:"days"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type KeybindingConfig struct {
|
type KeybindingConfig struct {
|
||||||
@ -367,7 +488,8 @@ type OSConfig struct {
|
|||||||
// Deprecated: use OpenLink instead.
|
// Deprecated: use OpenLink instead.
|
||||||
OpenLinkCommand string `yaml:"openLinkCommand,omitempty"`
|
OpenLinkCommand string `yaml:"openLinkCommand,omitempty"`
|
||||||
|
|
||||||
// CopyToClipboardCmd is the command for copying to clipboard
|
// CopyToClipboardCmd is the command for copying to clipboard.
|
||||||
|
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-clipboard
|
||||||
CopyToClipboardCmd string `yaml:"copyToClipboardCmd,omitempty"`
|
CopyToClipboardCmd string `yaml:"copyToClipboardCmd,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,50 +498,79 @@ type CustomCommandAfterHook struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CustomCommand struct {
|
type CustomCommand struct {
|
||||||
Key string `yaml:"key"`
|
// The key to trigger the command. Use a single letter or one of the values from https://github.com/jesseduffield/lazygit/blob/master/docs/keybindings/Custom_Keybindings.md
|
||||||
Context string `yaml:"context"`
|
Key string `yaml:"key"`
|
||||||
Command string `yaml:"command"`
|
// The context in which to listen for the key
|
||||||
Subprocess bool `yaml:"subprocess"`
|
Context string `yaml:"context"`
|
||||||
Prompts []CustomCommandPrompt `yaml:"prompts"`
|
// The command to run (using Go template syntax for placeholder values)
|
||||||
LoadingText string `yaml:"loadingText"`
|
Command string `yaml:"command"`
|
||||||
Description string `yaml:"description"`
|
// If true, run the command in a subprocess (e.g. if the command requires user input)
|
||||||
Stream bool `yaml:"stream"`
|
Subprocess bool `yaml:"subprocess"`
|
||||||
ShowOutput bool `yaml:"showOutput"`
|
// A list of prompts that will request user input before running the final command
|
||||||
After CustomCommandAfterHook `yaml:"after"`
|
Prompts []CustomCommandPrompt `yaml:"prompts"`
|
||||||
|
// Text to display while waiting for command to finish
|
||||||
|
LoadingText string `yaml:"loadingText"`
|
||||||
|
// Label for the custom command when displayed in the keybindings menu
|
||||||
|
Description string `yaml:"description"`
|
||||||
|
// If true, stream the command's output to the Command Log panel
|
||||||
|
Stream bool `yaml:"stream"`
|
||||||
|
// If true, show the command's output in a popup within Lazygit
|
||||||
|
ShowOutput bool `yaml:"showOutput"`
|
||||||
|
// Actions to take after the command has completed
|
||||||
|
After CustomCommandAfterHook `yaml:"after"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CustomCommandPrompt struct {
|
type CustomCommandPrompt struct {
|
||||||
// one of 'input', 'menu', 'confirm', or 'menuFromCommand'
|
// One of: 'input' | 'menu' | 'confirm' | 'menuFromCommand'
|
||||||
Type string `yaml:"type"`
|
Type string `yaml:"type"`
|
||||||
Key string `yaml:"key"`
|
// Used to reference the entered value from within the custom command. E.g. a prompt with `key: 'Branch'` can be referred to as `{{.Form.Branch}}` in the command
|
||||||
|
Key string `yaml:"key"`
|
||||||
|
// The title to display in the popup panel
|
||||||
Title string `yaml:"title"`
|
Title string `yaml:"title"`
|
||||||
|
|
||||||
// these only apply to input prompts
|
// The initial value to appear in the text box.
|
||||||
InitialValue string `yaml:"initialValue"`
|
// Only for input prompts.
|
||||||
Suggestions CustomCommandSuggestions `yaml:"suggestions"`
|
InitialValue string `yaml:"initialValue"`
|
||||||
|
// Shows suggestions as the input is entered
|
||||||
|
// Only for input prompts.
|
||||||
|
Suggestions CustomCommandSuggestions `yaml:"suggestions"`
|
||||||
|
|
||||||
// this only applies to confirm prompts
|
// The message of the confirmation prompt.
|
||||||
|
// Only for confirm prompts.
|
||||||
Body string `yaml:"body"`
|
Body string `yaml:"body"`
|
||||||
|
|
||||||
// this only applies to menus
|
// Menu options.
|
||||||
|
// Only for menu prompts.
|
||||||
Options []CustomCommandMenuOption
|
Options []CustomCommandMenuOption
|
||||||
|
|
||||||
// this only applies to menuFromCommand
|
// The command to run to generate menu options
|
||||||
Command string `yaml:"command"`
|
// Only for menuFromCommand prompts.
|
||||||
Filter string `yaml:"filter"`
|
Command string `yaml:"command"`
|
||||||
|
// The regexp to run specifying groups which are going to be kept from the command's output.
|
||||||
|
// Only for menuFromCommand prompts.
|
||||||
|
Filter string `yaml:"filter"`
|
||||||
|
// How to format matched groups from the filter to construct a menu item's value.
|
||||||
|
// Only for menuFromCommand prompts.
|
||||||
ValueFormat string `yaml:"valueFormat"`
|
ValueFormat string `yaml:"valueFormat"`
|
||||||
|
// Like valueFormat but for the labels. If `labelFormat` is not specified, `valueFormat` is shown instead.
|
||||||
|
// Only for menuFromCommand prompts.
|
||||||
LabelFormat string `yaml:"labelFormat"`
|
LabelFormat string `yaml:"labelFormat"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CustomCommandSuggestions struct {
|
type CustomCommandSuggestions struct {
|
||||||
Preset string `yaml:"preset"`
|
// Uses built-in logic to obtain the suggestions. One of 'authors' | 'branches' | 'files' | 'refs' | 'remotes' | 'remoteBranches' | 'tags'
|
||||||
|
Preset string `yaml:"preset"`
|
||||||
|
// Command to run such that each line in the output becomes a suggestion. Mutually exclusive with 'preset' field.
|
||||||
Command string `yaml:"command"`
|
Command string `yaml:"command"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CustomCommandMenuOption struct {
|
type CustomCommandMenuOption struct {
|
||||||
Name string `yaml:"name"`
|
// The first part of the label
|
||||||
|
Name string `yaml:"name"`
|
||||||
|
// The second part of the label
|
||||||
Description string `yaml:"description"`
|
Description string `yaml:"description"`
|
||||||
Value string `yaml:"value"`
|
// The value that will be used in the command
|
||||||
|
Value string `yaml:"value"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDefaultConfig() *UserConfig {
|
func GetDefaultConfig() *UserConfig {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user