mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-13 13:59:06 +02:00
Merge pull request #143 from jesseduffield/feature/clean_up
Platform should only be present once
This commit is contained in:
commit
ad3d332e05
@ -19,7 +19,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Platform stores the os state
|
// Platform stores the os state
|
||||||
type platform struct {
|
type Platform struct {
|
||||||
os string
|
os string
|
||||||
shell string
|
shell string
|
||||||
shellArg string
|
shellArg string
|
||||||
@ -29,7 +29,7 @@ type platform struct {
|
|||||||
// OSCommand holds all the os commands
|
// OSCommand holds all the os commands
|
||||||
type OSCommand struct {
|
type OSCommand struct {
|
||||||
Log *logrus.Logger
|
Log *logrus.Logger
|
||||||
Platform platform
|
Platform *Platform
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewOSCommand os command runner
|
// NewOSCommand os command runner
|
||||||
@ -67,17 +67,17 @@ func sanitisedCommandOutput(output []byte, err error) (string, error) {
|
|||||||
return outputString, err
|
return outputString, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPlatform() platform {
|
func getPlatform() *Platform {
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "windows":
|
case "windows":
|
||||||
return platform{
|
return &Platform{
|
||||||
os: "windows",
|
os: "windows",
|
||||||
shell: "cmd",
|
shell: "cmd",
|
||||||
shellArg: "/c",
|
shellArg: "/c",
|
||||||
escapedQuote: "\\\"",
|
escapedQuote: "\\\"",
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return platform{
|
return &Platform{
|
||||||
os: runtime.GOOS,
|
os: runtime.GOOS,
|
||||||
shell: "bash",
|
shell: "bash",
|
||||||
shellArg: "-c",
|
shellArg: "-c",
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"runtime"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -53,7 +52,7 @@ type guiState struct {
|
|||||||
ConflictTop bool
|
ConflictTop bool
|
||||||
Conflicts []commands.Conflict
|
Conflicts []commands.Conflict
|
||||||
EditHistory *stack.Stack
|
EditHistory *stack.Stack
|
||||||
Platform platform
|
Platform commands.Platform
|
||||||
Version string
|
Version string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +67,7 @@ func NewGui(log *logrus.Logger, gitCommand *commands.GitCommand, oSCommand *comm
|
|||||||
ConflictTop: true,
|
ConflictTop: true,
|
||||||
Conflicts: make([]commands.Conflict, 0),
|
Conflicts: make([]commands.Conflict, 0),
|
||||||
EditHistory: stack.New(),
|
EditHistory: stack.New(),
|
||||||
Platform: getPlatform(),
|
Platform: *oSCommand.Platform,
|
||||||
Version: "test version", // TODO: send version in
|
Version: "test version", // TODO: send version in
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,32 +80,6 @@ func NewGui(log *logrus.Logger, gitCommand *commands.GitCommand, oSCommand *comm
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type platform struct {
|
|
||||||
os string
|
|
||||||
shell string
|
|
||||||
shellArg string
|
|
||||||
escapedQuote string
|
|
||||||
}
|
|
||||||
|
|
||||||
func getPlatform() platform {
|
|
||||||
switch runtime.GOOS {
|
|
||||||
case "windows":
|
|
||||||
return platform{
|
|
||||||
os: "windows",
|
|
||||||
shell: "cmd",
|
|
||||||
shellArg: "/c",
|
|
||||||
escapedQuote: "\\\"",
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return platform{
|
|
||||||
os: runtime.GOOS,
|
|
||||||
shell: "bash",
|
|
||||||
shellArg: "-c",
|
|
||||||
escapedQuote: "\"",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gui *Gui) scrollUpMain(g *gocui.Gui, v *gocui.View) error {
|
func (gui *Gui) scrollUpMain(g *gocui.Gui, v *gocui.View) error {
|
||||||
mainView, _ := g.View("main")
|
mainView, _ := g.View("main")
|
||||||
ox, oy := mainView.Origin()
|
ox, oy := mainView.Origin()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user