diff --git a/justfile b/justfile new file mode 100644 index 0000000..e7b0bc9 --- /dev/null +++ b/justfile @@ -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 \ No newline at end of file diff --git a/main.go b/main.go index 6488c21..ebedff6 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "fmt" + math "math" "os" "os/exec" "sort" @@ -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 := " " diff --git a/version.go b/version.go index d1efcd7..ffca364 100644 --- a/version.go +++ b/version.go @@ -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:]) @@ -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) }