Skip to content

Commit f5bf230

Browse files
committed
fix: issue when you have less than 10 branches
1 parent 2de24a8 commit f5bf230

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

justfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
default: build
2+
3+
watch:
4+
npx nodemon -e go --exec "go build -o main *.go || exit 1"
5+
6+
build:
7+
go build -o main *.go

main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"fmt"
5+
math "math"
56
"os"
67
"os/exec"
78
"sort"
@@ -82,7 +83,7 @@ func main() {
8283
fmt.Println("")
8384

8485
var count = 1
85-
for branchIndex, branch := range branches[:10] {
86+
for branchIndex, branch := range branches[:int(math.Min(float64(len(branches)), 10))] {
8687
s := timeago.Of(branch.commitedAt)
8788

8889
space := " "

version.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"github.com/fatih/color"
88
)
99

10-
const Version string = "0.0.8"
11-
const BuildDate string = "2022-04-02"
10+
const Version string = "0.0.10"
11+
const BuildDate string = "2022-06-09"
1212

1313
func cliCommandDisplayVersion(args []string) {
1414
displayVersion := StringInSlice("-v", args[1:]) || StringInSlice("--version", args[1:])
@@ -19,7 +19,7 @@ func cliCommandDisplayVersion(args []string) {
1919
fmt.Println(bold("⚡️ Git branch"))
2020
fmt.Println()
2121
fmt.Println("build date: ", bold(BuildDate))
22-
fmt.Println("version: ", bold(Version))
22+
fmt.Println("version: ", bold(Version))
2323
fmt.Println()
2424
os.Exit(0)
2525
}

0 commit comments

Comments
 (0)