Skip to content

Commit

Permalink
allow hiding random tip
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseduffield committed Apr 12, 2021
1 parent 7669728 commit 4fb2dba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ gui:
skipUnstageLineWarning: false
skipStashWarning: true
showFileTree: false # for rendering changes files in a tree format
showRandomTip: true
showCommandLog: true
commandLogSize: 8
git:
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/user_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type GuiConfig struct {
CommitLength CommitLengthConfig `yaml:"commitLength"`
SkipNoStagedFilesWarning bool `yaml:"skipNoStagedFilesWarning"`
ShowFileTree bool `yaml:"showFileTree"`
ShowRandomTip bool `yaml:"showRandomTip"`
ShowCommandLog bool `yaml:"showCommandLog"`
CommandLogSize int `yaml:"commandLogSize"`
}
Expand Down Expand Up @@ -303,6 +304,7 @@ func GetDefaultConfig() *UserConfig {
SkipNoStagedFilesWarning: false,
ShowCommandLog: true,
ShowFileTree: false,
ShowRandomTip: true,
CommandLogSize: 8,
},
Git: GitConfig{
Expand Down
14 changes: 8 additions & 6 deletions pkg/gui/command_log_panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ func (gui *Gui) printCommandLogHeader() {
)
fmt.Fprintln(gui.Views.Extras, utils.ColoredString(introStr, color.FgCyan))

fmt.Fprintf(
gui.Views.Extras,
"%s: %s",
utils.ColoredString(gui.Tr.RandomTip, color.FgYellow),
utils.ColoredString(gui.getRandomTip(), color.FgGreen),
)
if gui.Config.GetUserConfig().Gui.ShowRandomTip {
fmt.Fprintf(
gui.Views.Extras,
"%s: %s",
utils.ColoredString(gui.Tr.RandomTip, color.FgYellow),
utils.ColoredString(gui.getRandomTip(), color.FgGreen),
)
}
}

func (gui *Gui) getRandomTip() string {
Expand Down

0 comments on commit 4fb2dba

Please sign in to comment.