1 Star 0 Fork 0

FuWah_Cheng/powerline-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
segment-plugin.go 496 Bytes
一键复制 编辑 原始数据 按行查看 历史
Thibault Jamet 提交于 2019-12-12 22:29 . Create segments in parallel
package main
import (
"encoding/json"
"os/exec"
pwl "github.com/justjanne/powerline-go/powerline"
)
func segmentPlugin(p *powerline, plugin string) ([]pwl.Segment, bool) {
output, err := exec.Command("powerline-go-" + plugin).Output()
if err != nil {
return nil, false
}
segments := []pwl.Segment{}
err = json.Unmarshal(output, &segments)
if err != nil {
// The plugin was found but no valid data was returned. Ignore it
return []pwl.Segment{}, true
}
return segments, true
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/neepaer/powerline-go.git
git@gitee.com:neepaer/powerline-go.git
neepaer
powerline-go
powerline-go
master

搜索帮助