Skip to content

Commit 5dee9d7

Browse files
TendToJanDeDobbeleer
authored andcommitted
fix: correct links for versions higher than 6
1 parent be9faf1 commit 5dee9d7

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/segments/bazel.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ func (c *Bazel) Init(props properties.Properties, env platform.Environment) {
3333
regex: `bazel (?P<version>((?P<major>[0-9]+).(?P<minor>[0-9]+).(?P<patch>[0-9]+)))`,
3434
},
3535
},
36-
// Use the correct URL for Bazel 6.x. it does not have the docs subdomain.
37-
versionURLTemplate: "https://{{ if ne .Major \"6\" }}docs.{{ end }}bazel.build/versions/{{ .Major }}.{{ .Minor }}.{{ .Patch }}",
36+
// Use the correct URL for Bazel >5.4.1, since they do not have the docs subdomain.
37+
versionURLTemplate: "https://{{ if lt .Major 6 }}docs.{{ end }}bazel.build/versions/{{ .Major }}.{{ .Minor }}.{{ .Patch }}",
3838
}
3939
c.Icon = props.GetString(Icon, "\ue63a")
4040
}

src/segments/bazel_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ func TestBazel(t *testing.T) {
1414
Version string
1515
Template string
1616
}{
17+
{Case: "bazel 4.0.0", ExpectedString: "<LINK>https://docs.bazel.build/versions/4.0.0<TEXT>\ue63a</TEXT></LINK> 4.0.0", Version: "bazel 4.0.0", Template: ""},
18+
{Case: "bazel 5.4.1", ExpectedString: "<LINK>https://docs.bazel.build/versions/5.4.1<TEXT>\ue63a</TEXT></LINK> 5.4.1", Version: "bazel 5.4.1", Template: ""},
1719
{Case: "bazel 6.4.0", ExpectedString: "<LINK>https://bazel.build/versions/6.4.0<TEXT>\ue63a</TEXT></LINK> 6.4.0", Version: "bazel 6.4.0", Template: ""},
18-
{Case: "bazel 10.11.12", ExpectedString: "<LINK>https://docs.bazel.build/versions/3.7.0<TEXT>\ue63a</TEXT></LINK> 3.7.0", Version: "bazel 3.7.0"},
19-
{Case: "", ExpectedString: "\ue63a err parsing info from bazel with", Version: ""},
20+
{Case: "bazel 7.1.1", ExpectedString: "<LINK>https://bazel.build/versions/7.1.1<TEXT>\ue63a</TEXT></LINK> 7.1.1", Version: "bazel 7.1.1", Template: ""},
21+
{Case: "bazel 10.11.12", ExpectedString: "<LINK>https://bazel.build/versions/10.11.12<TEXT>\ue63a</TEXT></LINK> 10.11.12", Version: "bazel 10.11.12", Template: ""},
22+
{Case: "", ExpectedString: "\ue63a err parsing info from bazel with", Version: "", Template: ""},
2023
}
2124
for _, tc := range cases {
2225
params := &mockedLanguageParams{

0 commit comments

Comments
 (0)