diff --git a/main.go b/main.go index 0593f20..303156c 100644 --- a/main.go +++ b/main.go @@ -23,6 +23,15 @@ func main() { cliCommandDisplayHelp(os.Args) var deleteMode = StringInSlice("-d", os.Args[1:]) || StringInSlice("--delete", os.Args[1:]) + var branchCount float64 = 10 + if os.Getenv("GIT_BRANCH_COUNT") != "" { + value, err := strconv.Atoi(os.Getenv("GIT_BRANCH_COUNT")) + if err != nil { + CheckIfError(err) + } else { + branchCount = float64(value) + } + } rootpath := getGitRootPath() @@ -97,7 +106,7 @@ func main() { fmt.Println("") var count = 1 - for branchIndex, branch := range branches[:int(math.Min(float64(len(branches)), 10))] { + for branchIndex, branch := range branches[:int(math.Min(float64(len(branches)), branchCount))] { var s string if branch.commitedAt.String() != "0001-01-01 00:00:00 +0000 UTC" { s = timeago.Of(branch.commitedAt) diff --git a/version.go b/version.go index a8e86c1..e2a9dd8 100644 --- a/version.go +++ b/version.go @@ -23,6 +23,10 @@ func cliCommandDisplayHelp(args []string) { fmt.Println("build date: ", bold(BuildDate)) fmt.Println("version: ", bold(Version)) fmt.Println() + fmt.Println("-v / --version : display this help menu") + fmt.Println("-d / --delete : enters the delete mode") + // fmt.Println("-c / --count : how many branches to display. Cares about GIT_BRANCH_COUNT") + fmt.Println() fmt.Println(italic("Need help?")) fmt.Println(italic("https://github.com/Tchoupinax/git-branch/issues")) os.Exit(0)