Skip to content

Commit f9aa650

Browse files
committed
wip github and gitea
Signed-off-by: jolheiser <[email protected]> # Conflicts: # go.mod # go.sum
1 parent 6fc8866 commit f9aa650

File tree

17 files changed

+729
-159
lines changed

17 files changed

+729
-159
lines changed

branch.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/charmbracelet/lipgloss"
1010
"github.com/muesli/gitty/vcs"
1111
"github.com/muesli/reflow/truncate"
12+
"github.com/muesli/termenv"
1213
)
1314

1415
func printBranch(branch vcs.Branch, stat *trackStat, maxWidth int) {
@@ -24,15 +25,23 @@ func printBranch(branch vcs.Branch, stat *trackStat, maxWidth int) {
2425
Foreground(lipgloss.Color(theme.colorDarkGray)).Width(70 - maxWidth)
2526

2627
var s string
27-
s += numberStyle.Render(branch.Name)
28+
name := numberStyle.Render(branch.Name)
29+
if useLinks {
30+
name = termenv.Hyperlink(branch.URL, name)
31+
}
32+
s += name
2833
s += genericStyle.Render(" ")
2934
s += stat.Render()
3035
s += genericStyle.Render(" ")
3136
s += titleStyle.Render(truncate.StringWithTail(branch.LastCommit.MessageHeadline, uint(70-maxWidth), "…"))
3237
s += genericStyle.Render(" ")
3338
s += timeStyle.Render(ago(branch.LastCommit.CommittedAt))
3439
s += genericStyle.Render(" ")
35-
s += authorStyle.Render(branch.LastCommit.Author)
40+
author := authorStyle.Render(branch.LastCommit.Author)
41+
if useLinks {
42+
author = termenv.Hyperlink(branch.LastCommit.AuthorURL, author)
43+
}
44+
s += author
3645

3746
fmt.Println(s)
3847
}

commit.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/dustin/go-humanize"
88
"github.com/muesli/gitty/vcs"
99
"github.com/muesli/reflow/truncate"
10+
"github.com/muesli/termenv"
1011
)
1112

1213
func printCommit(commit vcs.Commit) {
@@ -20,13 +21,21 @@ func printCommit(commit vcs.Commit) {
2021
Foreground(lipgloss.Color(theme.colorDarkGray)).Width(80 - 7)
2122

2223
var s string
23-
s += numberStyle.Render(commit.ID[:7])
24+
sha := numberStyle.Render(commit.ID[:7])
25+
if useLinks {
26+
sha = termenv.Hyperlink(commit.URL, sha)
27+
}
28+
s += sha
2429
s += genericStyle.Render(" ")
2530
s += titleStyle.Render(truncate.StringWithTail(commit.MessageHeadline, 80-7, "…"))
2631
s += genericStyle.Render(" ")
2732
s += timeStyle.Render(ago(commit.CommittedAt))
2833
s += genericStyle.Render(" ")
29-
s += numberStyle.Render(commit.Author)
34+
author := numberStyle.Render(commit.Author)
35+
if useLinks {
36+
author = termenv.Hyperlink(commit.AuthorURL, author)
37+
}
38+
s += author
3039

3140
fmt.Println(s)
3241
}

go.mod

Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,22 @@
11
module github.com/muesli/gitty
22

3-
go 1.17
3+
go 1.15
44

55
require (
66
code.gitea.io/sdk/gitea v0.15.1
7-
github.com/charmbracelet/lipgloss v0.7.1
8-
github.com/dustin/go-humanize v1.0.1
9-
github.com/go-git/go-git/v5 v5.6.1
7+
github.com/aymanbagabas/go-osc52 v1.2.1 // indirect
8+
github.com/charmbracelet/lipgloss v0.6.0
9+
github.com/dustin/go-humanize v1.0.0
10+
github.com/go-git/go-git/v5 v5.4.3-0.20220119145113-935af59cf64f
1011
github.com/kevinburke/ssh_config v1.2.0
1112
github.com/muesli/gamut v0.3.1
1213
github.com/muesli/reflow v0.3.0
13-
github.com/muesli/termenv v0.15.1
14+
github.com/muesli/termenv v0.13.0
15+
github.com/rivo/uniseg v0.4.2 // indirect
1416
github.com/shurcooL/githubv4 v0.0.0-20211117020012-5800b9de5b8b
15-
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
16-
github.com/xanzy/go-gitlab v0.83.0
17-
golang.org/x/oauth2 v0.7.0
18-
)
19-
20-
require (
21-
github.com/Microsoft/go-winio v0.5.2 // indirect
22-
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
23-
github.com/acomagu/bufpipe v1.0.4 // indirect
24-
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
25-
github.com/cloudflare/circl v1.1.0 // indirect
26-
github.com/emirpasic/gods v1.18.1 // indirect
27-
github.com/go-git/gcfg v1.5.0 // indirect
28-
github.com/go-git/go-billy/v5 v5.4.1 // indirect
29-
github.com/golang/protobuf v1.5.3 // indirect
30-
github.com/google/go-querystring v1.1.0 // indirect
31-
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
32-
github.com/hashicorp/go-retryablehttp v0.7.2 // indirect
33-
github.com/hashicorp/go-version v1.2.1 // indirect
34-
github.com/imdario/mergo v0.3.13 // indirect
35-
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
36-
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
37-
github.com/mattn/go-isatty v0.0.17 // indirect
38-
github.com/mattn/go-runewidth v0.0.14 // indirect
39-
github.com/muesli/clusters v0.0.0-20200529215643-2700303c1762 // indirect
40-
github.com/muesli/kmeans v0.3.1 // indirect
41-
github.com/pjbgf/sha1cd v0.3.0 // indirect
42-
github.com/rivo/uniseg v0.2.0 // indirect
43-
github.com/sergi/go-diff v1.1.0 // indirect
4417
github.com/shurcooL/graphql v0.0.0-20200928012149-18c5c3165e3a // indirect
45-
github.com/skeema/knownhosts v1.1.0 // indirect
46-
github.com/xanzy/ssh-agent v0.3.3 // indirect
47-
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
48-
golang.org/x/crypto v0.6.0 // indirect
49-
golang.org/x/net v0.9.0 // indirect
50-
golang.org/x/sys v0.7.0 // indirect
51-
golang.org/x/time v0.3.0 // indirect
52-
google.golang.org/appengine v1.6.7 // indirect
53-
google.golang.org/protobuf v1.29.1 // indirect
54-
gopkg.in/warnings.v0 v0.1.2 // indirect
18+
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
19+
github.com/xanzy/go-gitlab v0.73.1
20+
golang.org/x/oauth2 v0.0.0-20220722155238-128564f6959c
21+
golang.org/x/sys v0.1.0 // indirect
5522
)

0 commit comments

Comments
 (0)