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:
@@ -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()
|
||||
}
|
||||
|
@@ -34,3 +34,7 @@ func getUserShell() string {
|
||||
|
||||
return "bash"
|
||||
}
|
||||
|
||||
func (c *OSCommand) UpdateWindowTitle() error {
|
||||
return nil
|
||||
}
|
||||
|
@@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user