diff options
Diffstat (limited to 'utils.go')
| -rw-r--r-- | utils.go | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -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) |
