Skip to content

Commit 6a43d29

Browse files
committed
look at Changes.txt
1 parent 0b20699 commit 6a43d29

File tree

6 files changed

+52
-34
lines changed

6 files changed

+52
-34
lines changed

CHANGELOGS/Changes.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,8 @@ CHANGES: 21-06-19-03-2021
3232

3333
CHANGES: 21-06-23-03-2021
3434
- Added -version flag
35-
- Code cleaned up
35+
- Code cleaned up
36+
37+
CHANGES: 21-06-24-03-2021
38+
- Added version.txt to godemon path
39+
- code cleaned up

cliTools/loadFlags.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,33 @@ import (
77
"godemon/godemonInfo"
88
)
99

10-
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) {
10+
func LoadCMD(filepath string, modOrFile string) (string, string, string, string, *bool, bool, string, string, string, string, bool, bool, bool, string, string, bool, bool, bool) {
1111
var filepathP *string
12-
cmd := flag.Bool("cmd", false, "a bool")
13-
cnfM := flag.Bool("cnf", false, "a bool")
14-
deploy := flag.Bool("deploy", false, "a bool")
15-
filepathP = flag.String("path", "", "a string")
16-
commandP := flag.String("command", "", "a string")
17-
helpP := flag.Bool("help", false, "a bool")
18-
initP := flag.Bool("init", false, "a bool")
19-
nameP := flag.String("name", "", "a string")
20-
osP := flag.String("os", "", "a string")
21-
archP := flag.String("arch", "", "a string")
22-
mod := flag.Bool("mod", false, "a bool")
23-
file := flag.Bool("file", false, "a bool")
24-
addFileM := flag.Bool("addFile", false, "a bool")
25-
addCommandM := flag.Bool("addCommand", false, "a bool")
26-
addVariable := flag.Bool("addVariable", false, "a bool")
27-
value := flag.String("value", "", "a string")
28-
key := flag.String("key", "", "a string")
29-
updateName := flag.Bool("updateName", false, "a bool")
30-
updateArch := flag.Bool("updateArch", false, "a bool")
31-
updateOS := flag.Bool("updateOS", false, "a bool")
32-
versionF := flag.Bool("version", false, "a bool")
33-
changes := flag.Bool("logChanges", false, "a bool")
12+
cmd := flag.Bool("cmd", false, "CMD mode")
13+
cnfM := flag.Bool("cnf", false, "project.json mode")
14+
deploy := flag.Bool("deploy", false, "building project using info from project.json")
15+
filepathP = flag.String("path", "", "path to file or dir")
16+
commandP := flag.String("command", "", "command name")
17+
helpP := flag.Bool("help", false, "help section")
18+
initP := flag.Bool("init", false, "initialize project")
19+
nameP := flag.String("name", "", "name of project/file/command")
20+
osP := flag.String("os", "", "os variable")
21+
archP := flag.String("arch", "", "architecture variable")
22+
mod := flag.Bool("mod", false, "module option")
23+
file := flag.Bool("file", false, "file option")
24+
addFileM := flag.Bool("addFile", false, "add file to watching list in project.json")
25+
addCommandM := flag.Bool("addCommand", false, "add command to commands list in project.json")
26+
addVariable := flag.Bool("addVariable", false, "add tmp variable to project.json")
27+
value := flag.String("value", "", "value of ...")
28+
key := flag.String("key", "", "key of ...")
29+
updateName := flag.Bool("updateName", false, "update name of project")
30+
updateArch := flag.Bool("updateArch", false, "update arch of project")
31+
updateOS := flag.Bool("updateOS", false, "update os of project")
32+
versionF := flag.Bool("version", false, "print version of godemon")
33+
changes := flag.Bool("logChanges", false, "print changes")
3434
flag.Parse()
3535
if *versionF == true {
36-
godemonInfo.LogVersion(version)
36+
godemonInfo.LogVersion()
3737
}
3838
if *changes == true {
3939
godemonInfo.LogChanges()

controllers/functions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"os"
77
)
88

9-
func ProgramStarting(cnf *string, filepath string, modOrFile string, command string, help *bool, version string, init bool, name string, oso string, arch string, hOS string, addFile bool) (string, string) {
9+
func ProgramStarting(cnf *string, filepath string, modOrFile string, command string, help *bool, init bool, name string, oso string, arch string, hOS string, addFile bool) (string, string) {
1010
if *cnf == "cmd" {
1111

1212
} else if *cnf == "cnf" {
@@ -25,7 +25,7 @@ func ProgramStarting(cnf *string, filepath string, modOrFile string, command str
2525
(*cnf == "" && filepath == "" && modOrFile == "" &&
2626
command == "" && *help == false && init == false &&
2727
name == "" && oso == "" && arch == "") {
28-
models.HelpCLI(version)
28+
models.HelpCLI()
2929
}
3030
return filepath, modOrFile
3131
}

godemonInfo/version.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,20 @@ package godemonInfo
33
import (
44
"github.com/fatih/color"
55
"go/build"
6+
"io/ioutil"
67
"os"
8+
"strings"
79
)
810

9-
func LogVersion(version string) {
11+
func LoadVersion() string {
12+
godemonPath := os.Getenv("GODEMON")
13+
path := godemonPath + "/.infos/version.txt"
14+
v, _ := ioutil.ReadFile(path)
15+
return strings.TrimSpace(string(v))
16+
}
17+
18+
func LogVersion() {
19+
version := LoadVersion()
1020
fullVersion := "GODEMON-" + version + "-" + build.Default.GOOS + "_" + build.Default.GOARCH
1121
color.Yellow(fullVersion)
1222
os.Exit(1)

main.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//TODO - flags in commands
55
//TODO - update installer - add changelogs directory
66
//TODO - update updater - add changelogs updating
7+
//TODO - creating version.txt in .godemon/.infos
78

89
//TODO - WebPage
910

@@ -18,6 +19,7 @@ import (
1819
"godemon/controllers"
1920
"godemon/errors"
2021
"godemon/execs"
22+
"godemon/godemonInfo"
2123
"godemon/hotReload"
2224
"godemon/updateInfo"
2325
"os"
@@ -26,16 +28,16 @@ import (
2628

2729
func main() {
2830
hostInfo := [2]string{build.Default.GOOS, build.Default.GOARCH}
29-
color.Cyan("Godemon starting...")
30-
version := "21.06"
31-
color.HiMagenta("Welcome to godemon " + version)
3231
doneChan := make(chan bool)
33-
filepath, modOrFile, cnf, command, help, init, name, oso, arch, cont, addFile, addCmd, addVar, key, value, updateName, updateArch, updateOS := cliTools.LoadCMD("", "", version)
32+
version := godemonInfo.LoadVersion()
33+
filepath, modOrFile, cnf, command, help, init, name, oso, arch, cont, addFile, addCmd, addVar, key, value, updateName, updateArch, updateOS := cliTools.LoadCMD("", "")
3434
if cont == "Exit" {
3535
os.Exit(1)
3636
}
3737
updateInfo.Update(updateName, name, updateArch, arch, oso, updateOS, addVar, key, value, addCmd, modOrFile, filepath)
38-
filepath, modOrFile = controllers.ProgramStarting(&cnf, filepath, modOrFile, command, help, version, init, name, oso, arch, hostInfo[0], addFile)
38+
filepath, modOrFile = controllers.ProgramStarting(&cnf, filepath, modOrFile, command, help, init, name, oso, arch, hostInfo[0], addFile)
39+
color.Cyan("Godemon starting...")
40+
color.HiMagenta("Welcome to godemon " + version)
3941
for true {
4042
go func(doneChan chan bool) {
4143
defer func() {

models/staticCLI.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ package models
33
import (
44
"fmt"
55
"github.com/fatih/color"
6+
"godemon/godemonInfo"
67
"os"
78
)
89

9-
func HelpCLI(version string) {
10+
func HelpCLI() {
11+
version := godemonInfo.LoadVersion()
1012
color.Green("Godemon %v:", version)
1113
fmt.Printf("\nWhat flags do we have in Godemon? \n 1. Methods of godemon's runtime:" +
1214
"\n a) -cnf - using project.json file to load godemon project specifications,\n b) -cmd - manualy passing godemon project specification using the CLI,\n c) -deploy - deploying the project using specifications from project.json or CLI\n" +

0 commit comments

Comments
 (0)