1 Star 0 Fork 0

FuWah_Cheng/powerline-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
segment-gitlite.go 785 Bytes
一键复制 编辑 原始数据 按行查看 历史
package main
import (
"strings"
pwl "github.com/justjanne/powerline-go/powerline"
)
func segmentGitLite(p *powerline) []pwl.Segment {
if len(p.ignoreRepos) > 0 {
out, err := runGitCommand("git", "rev-parse", "--show-toplevel")
if err != nil {
return []pwl.Segment{}
}
out = strings.TrimSpace(out)
if p.ignoreRepos[out] {
return []pwl.Segment{}
}
}
out, err := runGitCommand("git", "rev-parse", "--abbrev-ref", "HEAD")
if err != nil {
return []pwl.Segment{}
}
status := strings.TrimSpace(out)
var branch string
if status == "HEAD" {
branch = getGitDetachedBranch(p)
} else {
branch = status
}
return []pwl.Segment{{
Name: "git-branch",
Content: branch,
Foreground: p.theme.RepoCleanFg,
Background: p.theme.RepoCleanBg,
}}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/neepaer/powerline-go.git
git@gitee.com:neepaer/powerline-go.git
neepaer
powerline-go
powerline-go
master

搜索帮助