1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-23 00:39:13 +02:00

Obtain branches in a more robust way. Begin refactor work on gitcommands

This commit is contained in:
Jesse Duffield
2018-08-10 21:33:49 +10:00
parent 3f89b5bf71
commit d08241b2ea
12 changed files with 221 additions and 178 deletions

23
utils.go Normal file
View File

@ -0,0 +1,23 @@
package main
import (
"strings"
"github.com/jesseduffield/gocui"
)
func splitLines(multilineString string) []string {
multilineString = strings.Replace(multilineString, "\r", "", -1)
if multilineString == "" || multilineString == "\n" {
return make([]string, 0)
}
lines := strings.Split(multilineString, "\n")
if lines[len(lines)-1] == "" {
return lines[:len(lines)-1]
}
return lines
}
func trimmedContent(v *gocui.View) string {
return strings.TrimSpace(v.Buffer())
}