mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-31 23:19:40 +02:00
Feature: Added repository name to status
This commit is contained in:
parent
aa4160d57a
commit
7eb673e574
@ -32,7 +32,8 @@ func refreshStatus(g *gocui.Gui) error {
|
|||||||
}
|
}
|
||||||
branch := branches[0]
|
branch := branches[0]
|
||||||
name := coloredString(branch.Name, branch.getColor())
|
name := coloredString(branch.Name, branch.getColor())
|
||||||
fmt.Fprint(v, " "+name)
|
repo := getCurrentProject()
|
||||||
|
fmt.Fprint(v, " "+repo+" → "+name)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
12
utils.go
12
utils.go
@ -2,6 +2,9 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
@ -40,3 +43,12 @@ func coloredString(str string, colorAttribute color.Attribute) string {
|
|||||||
func coloredStringDirect(str string, colour *color.Color) string {
|
func coloredStringDirect(str string, colour *color.Color) string {
|
||||||
return colour.SprintFunc()(fmt.Sprint(str))
|
return colour.SprintFunc()(fmt.Sprint(str))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// used to get the project name
|
||||||
|
func getCurrentProject() string {
|
||||||
|
pwd, err := os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalln(err.Error())
|
||||||
|
}
|
||||||
|
return filepath.Base(pwd)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user