From 7eb673e574debea04f46bfc50d4a2fdf9fa6aebe Mon Sep 17 00:00:00 2001 From: Glenn Vriesman Date: Fri, 10 Aug 2018 15:10:15 +0200 Subject: [PATCH] Feature: Added repository name to status --- status_panel.go | 3 ++- utils.go | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/status_panel.go b/status_panel.go index 46bc394ae..f3fcb8078 100644 --- a/status_panel.go +++ b/status_panel.go @@ -32,7 +32,8 @@ func refreshStatus(g *gocui.Gui) error { } branch := branches[0] name := coloredString(branch.Name, branch.getColor()) - fmt.Fprint(v, " "+name) + repo := getCurrentProject() + fmt.Fprint(v, " "+repo+" → "+name) return nil }) diff --git a/utils.go b/utils.go index 1ab5a9ed2..e2de46233 100644 --- a/utils.go +++ b/utils.go @@ -2,6 +2,9 @@ package main import ( "fmt" + "log" + "os" + "path/filepath" "strings" "github.com/fatih/color" @@ -40,3 +43,12 @@ func coloredString(str string, colorAttribute color.Attribute) string { func coloredStringDirect(str string, colour *color.Color) string { 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) +}