mirror of
				https://github.com/jesseduffield/lazygit.git
				synced 2025-10-30 23:57:43 +02:00 
			
		
		
		
	Fix github linter errors
This commit is contained in:
		| @@ -123,29 +123,24 @@ func (gui *Gui) getConfirmationPanelWidth() int { | ||||
| } | ||||
|  | ||||
| func (gui *Gui) prepareConfirmationPanel( | ||||
| 	title, | ||||
| 	prompt string, | ||||
| 	hasLoader bool, | ||||
| 	findSuggestionsFunc func(string) []*types.Suggestion, | ||||
| 	editable bool, | ||||
| 	mask bool, | ||||
| 	opts types.ConfirmOpts, | ||||
| ) error { | ||||
| 	gui.Views.Confirmation.HasLoader = hasLoader | ||||
| 	if hasLoader { | ||||
| 	gui.Views.Confirmation.HasLoader = opts.HasLoader | ||||
| 	if opts.HasLoader { | ||||
| 		gui.g.StartTicking() | ||||
| 	} | ||||
| 	gui.Views.Confirmation.Title = title | ||||
| 	gui.Views.Confirmation.Title = opts.Title | ||||
| 	// for now we do not support wrapping in our editor | ||||
| 	gui.Views.Confirmation.Wrap = !editable | ||||
| 	gui.Views.Confirmation.Wrap = !opts.Editable | ||||
| 	gui.Views.Confirmation.FgColor = theme.GocuiDefaultTextColor | ||||
| 	gui.Views.Confirmation.Mask = runeForMask(mask) | ||||
| 	gui.Views.Confirmation.Mask = runeForMask(opts.Mask) | ||||
|  | ||||
| 	gui.findSuggestions = findSuggestionsFunc | ||||
| 	if findSuggestionsFunc != nil { | ||||
| 	gui.findSuggestions = opts.FindSuggestionsFunc | ||||
| 	if opts.FindSuggestionsFunc != nil { | ||||
| 		suggestionsView := gui.Views.Suggestions | ||||
| 		suggestionsView.Wrap = false | ||||
| 		suggestionsView.FgColor = theme.GocuiDefaultTextColor | ||||
| 		gui.setSuggestions(findSuggestionsFunc("")) | ||||
| 		gui.setSuggestions(opts.FindSuggestionsFunc("")) | ||||
| 		suggestionsView.Visible = true | ||||
| 		suggestionsView.Title = fmt.Sprintf(gui.c.Tr.SuggestionsTitle, gui.c.UserConfig.Keybinding.Universal.TogglePanel) | ||||
| 	} | ||||
| @@ -177,13 +172,14 @@ func (gui *Gui) createPopupPanel(opts types.CreatePopupPanelOpts) error { | ||||
| 	gui.clearConfirmationViewKeyBindings() | ||||
|  | ||||
| 	err := gui.prepareConfirmationPanel( | ||||
| 		opts.Title, | ||||
| 		opts.Prompt, | ||||
| 		opts.HasLoader, | ||||
| 		opts.FindSuggestionsFunc, | ||||
| 		opts.Editable, | ||||
| 		opts.Mask, | ||||
| 	) | ||||
| 		types.ConfirmOpts{ | ||||
| 			Title:               opts.Title, | ||||
| 			Prompt:              opts.Prompt, | ||||
| 			HasLoader:           opts.HasLoader, | ||||
| 			FindSuggestionsFunc: opts.FindSuggestionsFunc, | ||||
| 			Editable:            opts.Editable, | ||||
| 			Mask:                opts.Mask, | ||||
| 		}) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|   | ||||
| @@ -359,7 +359,7 @@ func (gui *Gui) getFocusLayout() func(g *gocui.Gui) error { | ||||
| 		newView := gui.g.CurrentView() | ||||
| 		// for now we don't consider losing focus to a popup panel as actually losing focus | ||||
| 		if newView != previousView && !gui.isPopupPanel(newView.Name()) { | ||||
| 			if err := gui.onViewFocusLost(previousView, newView); err != nil { | ||||
| 			if err := gui.onViewFocusLost(previousView); err != nil { | ||||
| 				return err | ||||
| 			} | ||||
|  | ||||
| @@ -369,7 +369,7 @@ func (gui *Gui) getFocusLayout() func(g *gocui.Gui) error { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (gui *Gui) onViewFocusLost(oldView *gocui.View, newView *gocui.View) error { | ||||
| func (gui *Gui) onViewFocusLost(oldView *gocui.View) error { | ||||
| 	if oldView == nil { | ||||
| 		return nil | ||||
| 	} | ||||
|   | ||||
| @@ -49,7 +49,7 @@ func (self *UpstreamHelper) ParseUpstream(upstream string) (string, string, erro | ||||
| 	return upstreamRemote, upstreamBranch, nil | ||||
| } | ||||
|  | ||||
| func (self *UpstreamHelper) promptForUpstream(currentBranch *models.Branch, initialContent string, onConfirm func(string) error) error { | ||||
| func (self *UpstreamHelper) promptForUpstream(initialContent string, onConfirm func(string) error) error { | ||||
| 	return self.c.Prompt(types.PromptOpts{ | ||||
| 		Title:               self.c.Tr.EnterUpstream, | ||||
| 		InitialContent:      initialContent, | ||||
| @@ -62,11 +62,11 @@ func (self *UpstreamHelper) PromptForUpstreamWithInitialContent(currentBranch *m | ||||
| 	suggestedRemote := self.GetSuggestedRemote() | ||||
| 	initialContent := suggestedRemote + " " + currentBranch.Name | ||||
|  | ||||
| 	return self.promptForUpstream(currentBranch, initialContent, onConfirm) | ||||
| 	return self.promptForUpstream(initialContent, onConfirm) | ||||
| } | ||||
|  | ||||
| func (self *UpstreamHelper) PromptForUpstreamWithoutInitialContent(currentBranch *models.Branch, onConfirm func(string) error) error { | ||||
| 	return self.promptForUpstream(currentBranch, "", onConfirm) | ||||
| func (self *UpstreamHelper) PromptForUpstreamWithoutInitialContent(_ *models.Branch, onConfirm func(string) error) error { | ||||
| 	return self.promptForUpstream("", onConfirm) | ||||
| } | ||||
|  | ||||
| func (self *UpstreamHelper) GetSuggestedRemote() string { | ||||
|   | ||||
| @@ -11,7 +11,7 @@ import ( | ||||
| ) | ||||
|  | ||||
| func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription bool, cherryPickedCommitShaSet *set.Set[string], diffName string, timeFormat string, parseEmoji bool) [][]string { | ||||
| 	var displayFunc func(*models.Commit, string, bool, bool, bool) []string | ||||
| 	var displayFunc func(*models.Commit, reflogCommitDisplayAttributes) []string | ||||
| 	if fullDescription { | ||||
| 		displayFunc = getFullDescriptionDisplayStringsForReflogCommit | ||||
| 	} else { | ||||
| @@ -21,7 +21,13 @@ func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription | ||||
| 	return slices.Map(commits, func(commit *models.Commit) []string { | ||||
| 		diffed := commit.Sha == diffName | ||||
| 		cherryPicked := cherryPickedCommitShaSet.Includes(commit.Sha) | ||||
| 		return displayFunc(commit, timeFormat, cherryPicked, diffed, parseEmoji) | ||||
| 		return displayFunc(commit, | ||||
| 			reflogCommitDisplayAttributes{ | ||||
| 				cherryPicked: cherryPicked, | ||||
| 				diffed:       diffed, | ||||
| 				parseEmoji:   parseEmoji, | ||||
| 				timeFormat:   timeFormat, | ||||
| 			}) | ||||
| 	}) | ||||
| } | ||||
|  | ||||
| @@ -38,27 +44,34 @@ func reflogShaColor(cherryPicked, diffed bool) style.TextStyle { | ||||
| 	return shaColor | ||||
| } | ||||
|  | ||||
| func getFullDescriptionDisplayStringsForReflogCommit(c *models.Commit, timeFormat string, cherryPicked, diffed, parseEmoji bool) []string { | ||||
| type reflogCommitDisplayAttributes struct { | ||||
| 	cherryPicked bool | ||||
| 	diffed       bool | ||||
| 	parseEmoji   bool | ||||
| 	timeFormat   string | ||||
| } | ||||
|  | ||||
| func getFullDescriptionDisplayStringsForReflogCommit(c *models.Commit, attrs reflogCommitDisplayAttributes) []string { | ||||
| 	name := c.Name | ||||
| 	if parseEmoji { | ||||
| 	if attrs.parseEmoji { | ||||
| 		name = emoji.Sprint(name) | ||||
| 	} | ||||
|  | ||||
| 	return []string{ | ||||
| 		reflogShaColor(cherryPicked, diffed).Sprint(c.ShortSha()), | ||||
| 		style.FgMagenta.Sprint(utils.UnixToDate(c.UnixTimestamp, timeFormat)), | ||||
| 		reflogShaColor(attrs.cherryPicked, attrs.diffed).Sprint(c.ShortSha()), | ||||
| 		style.FgMagenta.Sprint(utils.UnixToDate(c.UnixTimestamp, attrs.timeFormat)), | ||||
| 		theme.DefaultTextColor.Sprint(name), | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func getDisplayStringsForReflogCommit(c *models.Commit, timeFormat string, cherryPicked, diffed, parseEmoji bool) []string { | ||||
| func getDisplayStringsForReflogCommit(c *models.Commit, attrs reflogCommitDisplayAttributes) []string { | ||||
| 	name := c.Name | ||||
| 	if parseEmoji { | ||||
| 	if attrs.parseEmoji { | ||||
| 		name = emoji.Sprint(name) | ||||
| 	} | ||||
|  | ||||
| 	return []string{ | ||||
| 		reflogShaColor(cherryPicked, diffed).Sprint(c.ShortSha()), | ||||
| 		reflogShaColor(attrs.cherryPicked, attrs.diffed).Sprint(c.ShortSha()), | ||||
| 		theme.DefaultTextColor.Sprint(name), | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -96,6 +96,10 @@ type ConfirmOpts struct { | ||||
| 	HandleConfirm       func() error | ||||
| 	HandleClose         func() error | ||||
| 	HandlersManageFocus bool | ||||
| 	HasLoader           bool | ||||
| 	FindSuggestionsFunc func(string) []*Suggestion | ||||
| 	Editable            bool | ||||
| 	Mask                bool | ||||
| } | ||||
|  | ||||
| type PromptOpts struct { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user