summaryrefslogtreecommitdiff
path: root/utils.go
diff options
context:
space:
mode:
authorNikolaus Gotsche <n@softwarefools.com>2018-09-15 03:31:52 +0200
committerNikolaus Gotsche <n@softwarefools.com>2018-09-15 03:31:52 +0200
commitb67ad525147b8d219ff3508674dec3b25a3f62f0 (patch)
tree2684d4bb2dce753a9d90b892735f45360e5413b0 /utils.go
parent4fa9a4e986d457b406236fc62a5955a2275b83a9 (diff)
Makefile added, everything streamlined0.2.10.2.0
Diffstat (limited to 'utils.go')
-rw-r--r--utils.go36
1 files changed, 36 insertions, 0 deletions
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)