Make the links in the status panel point to the current version rather than master

We've seen a lot of issues recently where people complain that lazygit doesn't
behave as documented, but that was only because they were running the latest
release but were looking at the documentation of master. Make the documentation
links in the status panel point to the release that they are using in the hope
that this will help a little bit with this problem.
This commit is contained in:
Stefan Haller 2024-03-19 08:42:08 +01:00
parent 251bfb6a24
commit fa79c92748
2 changed files with 13 additions and 4 deletions

View file

@ -28,9 +28,9 @@ var Links = struct {
CustomPagers: "https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md",
CustomKeybindings: "https://github.com/jesseduffield/lazygit/blob/master/docs/keybindings/Custom_Keybindings.md",
CustomCommands: "https://github.com/jesseduffield/lazygit/wiki/Custom-Commands-Compendium",
Keybindings: "https://github.com/jesseduffield/lazygit/blob/master/docs/keybindings",
Keybindings: "https://github.com/jesseduffield/lazygit/blob/%s/docs/keybindings",
Undoing: "https://github.com/jesseduffield/lazygit/blob/master/docs/Undoing.md",
Config: "https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md",
Config: "https://github.com/jesseduffield/lazygit/blob/%s/docs/Config.md",
Tutorial: "https://youtu.be/VDXvbHZYeKY",
CustomPatchDemo: "https://github.com/jesseduffield/lazygit#rebase-magic-custom-patches",
},

View file

@ -68,13 +68,22 @@ func (self *StatusController) GetKeybindings(opts types.KeybindingsOpts) []*type
}
func (self *StatusController) GetOnRenderToMain() func() error {
versionStr := "master"
version, err := types.ParseVersionNumber(self.c.GetConfig().GetVersion())
if err == nil {
// Don't just take the version string as is, but format it again. This
// way it will be correct even if a distribution omits the "v", or the
// ".0" at the end.
versionStr = fmt.Sprintf("v%d.%d.%d", version.Major, version.Minor, version.Patch)
}
return func() error {
dashboardString := strings.Join(
[]string{
lazygitTitle(),
"Copyright 2022 Jesse Duffield",
fmt.Sprintf("Keybindings: %s", constants.Links.Docs.Keybindings),
fmt.Sprintf("Config Options: %s", constants.Links.Docs.Config),
fmt.Sprintf("Keybindings: %s", fmt.Sprintf(constants.Links.Docs.Keybindings, versionStr)),
fmt.Sprintf("Config Options: %s", fmt.Sprintf(constants.Links.Docs.Config, versionStr)),
fmt.Sprintf("Tutorial: %s", constants.Links.Docs.Tutorial),
fmt.Sprintf("Raise an Issue: %s", constants.Links.Issues),
fmt.Sprintf("Release Notes: %s", constants.Links.Releases),