1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-24 19:39:16 +02:00

Cleanup: move UpdateWindowTitle to platform-specific source files

No need to do a runtime check if we already have the platform-specific files.
This commit is contained in:
Stefan Haller
2025-08-08 20:12:05 +02:00
parent 77a9207f9e
commit e5acbed848
3 changed files with 19 additions and 13 deletions

View File

@@ -1,7 +1,6 @@
package oscommands
import (
"fmt"
"io"
"os"
"os/exec"
@@ -329,15 +328,3 @@ func GetLazygitPath() string {
}
return `"` + filepath.ToSlash(ex) + `"`
}
func (c *OSCommand) UpdateWindowTitle() error {
if c.Platform.OS != "windows" {
return nil
}
path, getWdErr := os.Getwd()
if getWdErr != nil {
return getWdErr
}
argString := fmt.Sprint("title ", filepath.Base(path), " - Lazygit")
return c.Cmd.NewShell(argString, c.UserConfig().OS.ShellFunctionsFile).Run()
}

View File

@@ -34,3 +34,7 @@ func getUserShell() string {
return "bash"
}
func (c *OSCommand) UpdateWindowTitle() error {
return nil
}

View File

@@ -1,5 +1,11 @@
package oscommands
import (
"fmt"
"os"
"path/filepath"
)
func GetPlatform() *Platform {
return &Platform{
OS: "windows",
@@ -7,3 +13,12 @@ func GetPlatform() *Platform {
ShellArg: "/c",
}
}
func (c *OSCommand) UpdateWindowTitle() error {
path, getWdErr := os.Getwd()
if getWdErr != nil {
return getWdErr
}
argString := fmt.Sprint("title ", filepath.Base(path), " - Lazygit")
return c.Cmd.NewShell(argString, c.UserConfig().OS.ShellFunctionsFile).Run()
}