From b67ad525147b8d219ff3508674dec3b25a3f62f0 Mon Sep 17 00:00:00 2001 From: Nikolaus Gotsche Date: Sat, 15 Sep 2018 03:31:52 +0200 Subject: Makefile added, everything streamlined --- utils.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'utils.go') diff --git a/utils.go b/utils.go index ad9693d..1400d63 100644 --- a/utils.go +++ b/utils.go @@ -4,12 +4,48 @@ import ( "fmt" "bufio" "os" + "os/exec" "math" "strings" "strconv" "runtime" ) +func getGitTag() string { + var ( + cmdOut []byte + err error + ) + cmd := "git" + args := []string{"tag","--points-at","HEAD"} + if cmdOut,err = exec.Command(cmd,args...).Output(); err != nil { + panic(err) + } + return string(cmdOut) +} + +//Remove a string from a []string and the int number of strings afterwards +func removeStringFromArray(arr []string,rem string,after int) (out []string) { + found := false + i := 0 + for _,st := range arr { + if found { + if i < after { + i++ + }else{ + found = false + } + }else{ + if st == rem { + found = true + }else{ + out = append(out,st) + } + } + } + return +} + func isSure(quest string) bool { fmt.Printf("%s (type 'y/Y/yes' to confirm) : ",quest) in := bufio.NewReader(os.Stdin) -- cgit v1.2.3