show lazydocker config in about tab

This commit is contained in:
Jesse Duffield 2019-06-29 09:16:29 +10:00
parent 3105c03bbe
commit b644249d0e
2 changed files with 17 additions and 8 deletions

View file

@ -1,6 +1,7 @@
package gui package gui
import ( import (
"bytes"
"fmt" "fmt"
"strings" "strings"
@ -9,6 +10,7 @@ import (
"github.com/jesseduffield/gocui" "github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazydocker/pkg/commands" "github.com/jesseduffield/lazydocker/pkg/commands"
"github.com/jesseduffield/lazydocker/pkg/utils" "github.com/jesseduffield/lazydocker/pkg/utils"
"gopkg.in/yaml.v2"
) )
func (gui *Gui) getStatusContexts() []string { func (gui *Gui) getStatusContexts() []string {
@ -20,7 +22,7 @@ func (gui *Gui) getStatusContexts() []string {
func (gui *Gui) getStatusContextTitles() []string { func (gui *Gui) getStatusContextTitles() []string {
if gui.DockerCommand.InDockerComposeProject { if gui.DockerCommand.InDockerComposeProject {
return []string{gui.Tr.LogsTitle, gui.Tr.CreditsTitle, gui.Tr.ConfigTitle} return []string{gui.Tr.LogsTitle, gui.Tr.CreditsTitle, gui.Tr.DockerComposeConfigTitle}
} }
return []string{gui.Tr.CreditsTitle} return []string{gui.Tr.CreditsTitle}
} }
@ -83,6 +85,9 @@ func (gui *Gui) renderCredits() error {
mainView.Autoscroll = false mainView.Autoscroll = false
mainView.Wrap = true mainView.Wrap = true
var configBuf bytes.Buffer
yaml.NewEncoder(&configBuf).Encode(gui.Config.UserConfig)
dashboardString := strings.Join( dashboardString := strings.Join(
[]string{ []string{
lazydockerTitle(), lazydockerTitle(),
@ -91,6 +96,8 @@ func (gui *Gui) renderCredits() error {
"Config Options: https://github.com/jesseduffield/lazydocker/blob/master/docs/Config.md", "Config Options: https://github.com/jesseduffield/lazydocker/blob/master/docs/Config.md",
"Raise an Issue: https://github.com/jesseduffield/lazydocker/issues", "Raise an Issue: https://github.com/jesseduffield/lazydocker/issues",
utils.ColoredString("Buy Jesse a coffee: https://donorbox.org/lazydocker", color.FgMagenta), // caffeine ain't free utils.ColoredString("Buy Jesse a coffee: https://donorbox.org/lazydocker", color.FgMagenta), // caffeine ain't free
"Here's what you lazydocker config is when merged with the defaults (you can open your config by pressing 'o'):",
configBuf.String(),
}, "\n\n") }, "\n\n")
gui.renderString(gui.g, "main", dashboardString) gui.renderString(gui.g, "main", dashboardString)

View file

@ -70,11 +70,12 @@ type TranslationSet struct {
ViewRestartOptions string ViewRestartOptions string
RunCustomCommand string RunCustomCommand string
LogsTitle string LogsTitle string
ConfigTitle string ConfigTitle string
StatsTitle string DockerComposeConfigTitle string
CreditsTitle string StatsTitle string
ContainerConfigTitle string CreditsTitle string
ContainerConfigTitle string
} }
func englishSet() TranslationSet { func englishSet() TranslationSet {
@ -98,8 +99,8 @@ func englishSet() TranslationSet {
Close: "close", Close: "close",
Menu: "menu", Menu: "menu",
Scroll: "scroll", Scroll: "scroll",
OpenConfig: "open config container", OpenConfig: "open lazydocker config",
EditConfig: "edit config container", EditConfig: "edit lazydocker config",
Cancel: "cancel", Cancel: "cancel",
Remove: "remove", Remove: "remove",
ForceRemove: "force remove", ForceRemove: "force remove",
@ -137,6 +138,7 @@ func englishSet() TranslationSet {
ErrorTitle: "Error", ErrorTitle: "Error",
LogsTitle: "Logs", LogsTitle: "Logs",
ConfigTitle: "Config", ConfigTitle: "Config",
DockerComposeConfigTitle: "Docker-Compose Config",
TopTitle: "Top", TopTitle: "Top",
StatsTitle: "Stats", StatsTitle: "Stats",
CreditsTitle: "About", CreditsTitle: "About",