Skip to content

Commit 947258c

Browse files
author
Bubunyo Nyavor
committed
add some more tags
1 parent 8e21bea commit 947258c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

rbs.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ import (
99
)
1010

1111
type branch struct {
12-
RelativeTime string
12+
ObjectName string
1313
Name string
14-
Author string
14+
RelativeTime string
15+
Track string
16+
Subject string
1517
}
1618

1719
func Run() {
18-
// format eg 25 minutes ago|master|Bubunyo Nyavor
19-
resFormat := `"%(committerdate:relative)|%(refname:short)|%(authorname)"`
20+
// command - git branch --sort=-committerdate
21+
// --format="%(committerdate:unix)|%(committerdate:relative)|%(refname:short)|%(authorname)|%(contents:subject)|%(objectname:short)"
22+
resFormat := `%(objectname:short)|%(refname:short)|%(committerdate:relative)|%(upstream:track)|%(contents:subject)`
2023
cmd := exec.Command("git", "branch",
2124
"--sort=-committerdate",
2225
"--format="+resFormat)
@@ -39,16 +42,16 @@ func Run() {
3942
continue
4043
}
4144
p := strings.Split(v, "|")
42-
branches = append(branches, branch{p[0], p[1], p[2]})
45+
branches = append(branches, branch{p[0], p[1], p[2], p[3], p[4]})
4346
if len(p[1]) > branchNameMaxLen {
4447
branchNameMaxLen = len(p[1])
4548
}
4649
}
4750

4851
templates := &promptui.SelectTemplates{
4952
Label: "{{ . }}?",
50-
Active: "\U0000279C ({{ .RelativeTime | red }}) {{ .Name | green }}",
51-
Inactive: " ({{ .RelativeTime | red | faint }}) {{ .Name | cyan | faint }}",
53+
Active: "\U0000279C [{{ .ObjectName | yellow }}] {{ .Name | green }} ({{ .RelativeTime | cyan }}) - {{ .Track | magenta }} {{ .Subject }}",
54+
Inactive: " [{{ .ObjectName | yellow | faint }}] {{ .Name | green | faint }} ({{ .RelativeTime | cyan | faint }}) - {{ .Track | magenta | faint }} {{ .Subject | faint }}",
5255
Selected: "git checkout {{ .Name | green | cyan }}",
5356
}
5457

0 commit comments

Comments
 (0)