diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-02-13 10:48:41 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-17 19:13:40 +1100 |
commit | 41527270ed9270ef6c463866e9c761f2285af857 (patch) | |
tree | b46231e732b100701f82acbea7269d8e76f2dd07 /pkg/gui/context.go | |
parent | 3188526ecb1e48327249a830173de7ab5ce5978a (diff) |
appease linter
Diffstat (limited to 'pkg/gui/context.go')
-rw-r--r-- | pkg/gui/context.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/gui/context.go b/pkg/gui/context.go index b59f0a448..9f097f78a 100644 --- a/pkg/gui/context.go +++ b/pkg/gui/context.go @@ -3,6 +3,8 @@ package gui import ( "errors" "fmt" + "sort" + "strings" "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/gui/context" @@ -222,6 +224,19 @@ func (gui *Gui) activateContext(c types.Context, opts ...types.OnFocusOpts) erro return nil } +func (gui *Gui) optionsMapToString(optionsMap map[string]string) string { + optionsArray := make([]string, 0) + for key, description := range optionsMap { + optionsArray = append(optionsArray, key+": "+description) + } + sort.Strings(optionsArray) + return strings.Join(optionsArray, ", ") +} + +func (gui *Gui) renderOptionsMap(optionsMap map[string]string) { + _ = gui.renderString(gui.Views.Options, gui.optionsMapToString(optionsMap)) +} + // also setting context on view for now. We'll need to pick one of these two approaches to stick with. func (gui *Gui) ViewContextMapSet(viewName string, c types.Context) { gui.State.ViewContextMap.Set(viewName, c) |