Skip to content

Commit

Permalink
fix: issue when you have less than 10 branches
Browse files Browse the repository at this point in the history
  • Loading branch information
Tchoupinax committed Jun 9, 2022
1 parent 2de24a8 commit f5bf230
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 7 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
default: build

watch:
npx nodemon -e go --exec "go build -o main *.go || exit 1"

build:
go build -o main *.go
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
math "math"
"os"
"os/exec"
"sort"
Expand Down Expand Up @@ -82,7 +83,7 @@ func main() {
fmt.Println("")

var count = 1
for branchIndex, branch := range branches[:10] {
for branchIndex, branch := range branches[:int(math.Min(float64(len(branches)), 10))] {
s := timeago.Of(branch.commitedAt)

space := " "
Expand Down
6 changes: 3 additions & 3 deletions version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/fatih/color"
)

const Version string = "0.0.8"
const BuildDate string = "2022-04-02"
const Version string = "0.0.10"
const BuildDate string = "2022-06-09"

func cliCommandDisplayVersion(args []string) {
displayVersion := StringInSlice("-v", args[1:]) || StringInSlice("--version", args[1:])
Expand All @@ -19,7 +19,7 @@ func cliCommandDisplayVersion(args []string) {
fmt.Println(bold("⚡️ Git branch"))
fmt.Println()
fmt.Println("build date: ", bold(BuildDate))
fmt.Println("version: ", bold(Version))
fmt.Println("version: ", bold(Version))
fmt.Println()
os.Exit(0)
}
Expand Down

0 comments on commit f5bf230

Please sign in to comment.