Skip to content

Commit 0b20699

Browse files
committed
look at Changes.txt
1 parent 3dc161e commit 0b20699

File tree

4 files changed

+34
-13
lines changed

4 files changed

+34
-13
lines changed

CHANGELOGS/Changes.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ CHANGES: 21-06-19-03-2021
3131
- Added changelogs passing to CLI
3232

3333
CHANGES: 21-06-23-03-2021
34-
- Added -version flag
34+
- Added -version flag
35+
- Code cleaned up

cliTools/loadFlags.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import (
44
"flag"
55
"github.com/fatih/color"
66
"go/build"
7-
"os"
8-
"os/exec"
7+
"godemon/godemonInfo"
98
)
109

1110
func LoadCMD(filepath string, modOrFile string, version string) (string, string, string, string, *bool, bool, string, string, string, string, bool, bool, bool, string, string, bool, bool, bool) {
@@ -34,18 +33,10 @@ func LoadCMD(filepath string, modOrFile string, version string) (string, string,
3433
changes := flag.Bool("logChanges", false, "a bool")
3534
flag.Parse()
3635
if *versionF == true {
37-
fullVersion := "GODEMON-" + version + "-" + build.Default.GOOS + "_" + build.Default.GOARCH
38-
color.Yellow(fullVersion)
39-
os.Exit(1)
36+
godemonInfo.LogVersion(version)
4037
}
4138
if *changes == true {
42-
godemonPath := os.Getenv("GODEMON")
43-
path := godemonPath + "/CHANGELOGS/Changes.txt"
44-
cmd := exec.Command("cat", path)
45-
cmd.Stdout = os.Stdout
46-
cmd.Stderr = os.Stderr
47-
cmd.Run()
48-
os.Exit(1)
39+
godemonInfo.LogChanges()
4940
}
5041
cnf := ""
5142
modOrFile = ""

godemonInfo/changes.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package godemonInfo
2+
3+
import (
4+
"os"
5+
"os/exec"
6+
)
7+
8+
func LogChanges() {
9+
godemonPath := os.Getenv("GODEMON")
10+
path := godemonPath + "/CHANGELOGS/Changes.txt"
11+
cmd := exec.Command("cat", path)
12+
cmd.Stdout = os.Stdout
13+
cmd.Stderr = os.Stderr
14+
cmd.Run()
15+
os.Exit(1)
16+
}

godemonInfo/version.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package godemonInfo
2+
3+
import (
4+
"github.com/fatih/color"
5+
"go/build"
6+
"os"
7+
)
8+
9+
func LogVersion(version string) {
10+
fullVersion := "GODEMON-" + version + "-" + build.Default.GOOS + "_" + build.Default.GOARCH
11+
color.Yellow(fullVersion)
12+
os.Exit(1)
13+
}

0 commit comments

Comments
 (0)