Skip to content

Commit be623cd

Browse files
committed
Updated help section
1 parent 44ee44b commit be623cd

File tree

4 files changed

+44
-46
lines changed

4 files changed

+44
-46
lines changed

CHANGELOGS/Changes.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
CHANGES: 21-11-25/...-10/.../2021
2+
- Updated help section
3+
14
CHANGES: 21-04-03-03-2021
25
- Added function that edit the 'project.json' by using CLI tools
36
- Models package refactored - created files:

cliTools/loadFlags.go

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,60 @@ package cliTools
22

33
import (
44
"flag"
5-
"github.com/fatih/color"
65
"go/build"
76
"godemon/godemonInfo"
7+
8+
"github.com/fatih/color"
89
)
910

1011
func LoadCMD(filepath string, modOrFile string) (string, string, string, string, *bool, bool, string, string, string, string, bool, bool, bool, string, string, bool, bool, bool) {
1112
var filepathP *string
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")
13+
cmd := flag.Bool("cmd", false, "Manualy passing godemon project specification using the CLI.")
14+
cnfM := flag.Bool("cnf", false, "Using project.json file to load godemon project specifications.")
15+
deploy := flag.Bool("deploy", false, "Deploying the project using specifications from project.json or CLI")
16+
filepathP = flag.String("path", "", "Path to file or dir")
17+
commandP := flag.String("command", "", "command's name (in project.json)")
18+
helpP := flag.Bool("help", false, "Help section")
19+
initP := flag.Bool("init", false, "Initialize project")
20+
nameP := flag.String("name", "", "Name of project/file/command")
21+
osP := flag.String("os", "", "OS variable")
22+
archP := flag.String("arch", "", "Architecture variable")
23+
mod := flag.Bool("mod", false, "Using as module")
24+
file := flag.Bool("file", false, "Using as single file")
25+
addFileM := flag.Bool("addFile", false, "Add file to watching list in project.json")
26+
addCommandM := flag.Bool("addCommand", false, "Add command to commands list in project.json")
27+
addVariable := flag.Bool("addVariable", false, "Add tmp variable to project.json")
28+
value := flag.String("value", "", "value of developer variable")
29+
key := flag.String("key", "", "key of developer variable")
30+
updateName := flag.Bool("updateName", false, "Update name of project")
31+
updateArch := flag.Bool("updateArch", false, "Update arch of project")
32+
updateOS := flag.Bool("updateOS", false, "Update os of project")
33+
versionF := flag.Bool("version", false, "Print version of godemon")
34+
changes := flag.Bool("logChanges", false, "Print changes")
3435
flag.Parse()
35-
if *versionF == true {
36+
if *versionF {
3637
godemonInfo.LogVersion()
3738
}
38-
if *changes == true {
39+
if *changes {
3940
godemonInfo.LogChanges()
4041
}
4142
cnf := ""
4243
modOrFile = ""
43-
if *mod == true {
44+
if *mod {
4445
modOrFile = "mod"
45-
} else if *file == true {
46+
} else if *file {
4647
modOrFile = "mod"
4748
}
4849
addFile := false
49-
if *cmd == true {
50+
if *cmd {
5051
cnf = "cmd"
51-
} else if *cnfM == true {
52+
} else if *cnfM {
5253
cnf = "cnf"
53-
} else if *deploy == true {
54+
} else if *deploy {
5455
cnf = "deploy"
55-
} else if (*cmd == true && *cnfM == true) || (*cmd == true && *deploy == true) || (*cnfM == true && *deploy == true) {
56+
} else if (*cmd && *cnfM) || (*cmd && *deploy) || (*cnfM && *deploy) {
5657
color.Red("Too many mode parameters")
57-
} else if *addFileM == true {
58+
} else if *addFileM {
5859
addFile = true
5960
}
6061
filepath = *filepathP
@@ -65,10 +66,10 @@ func LoadCMD(filepath string, modOrFile string) (string, string, string, string,
6566
command := *commandP
6667

6768
cont := ""
68-
if init == true && name == "" {
69+
if init && name == "" {
6970
color.Red("Missing parameter: -name")
7071
cont = "Exit"
71-
} else if init == true {
72+
} else if init {
7273
if arch == "" && os == "" {
7374
arch = build.Default.GOARCH
7475
os = build.Default.GOOS
@@ -78,10 +79,10 @@ func LoadCMD(filepath string, modOrFile string) (string, string, string, string,
7879
os = build.Default.GOOS
7980
}
8081
}
81-
if *deploy == true && (*file == true || *cmd == true || *cnfM == true || *filepathP != "" || *commandP != "" || *helpP == true || *initP == true || *nameP != "" || *osP != "" || *archP != "" || *mod == true) {
82+
if *deploy && (*file || *cmd || *cnfM || *filepathP != "" || *commandP != "" || *helpP || *initP || *nameP != "" || *osP != "" || *archP != "" || *mod) {
8283
color.Yellow("Warning!!! Deploy takes only deploy argument")
8384
}
84-
if *cnfM == true && *commandP == "" {
85+
if *cnfM && *commandP == "" {
8586
color.Red("You must specify a command")
8687
}
8788
return filepath, modOrFile, cnf, command, helpP, init, name, os, arch, cont, addFile, *addCommandM, *addVariable, *key, *value, *updateName, *updateArch, *updateOS

main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
//TODO - 21.12 - user errors
1212
//TODO - 21.12 - windows installer
13-
//TODO - 21.12 - help and etc. sections to update
1413

1514
//TODO - 21.12 - check compiler error handling
1615
//TODO - 21.12 - create error messages

models/staticCLI.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
package models
22

33
import (
4-
"fmt"
5-
"github.com/fatih/color"
4+
"flag"
65
"godemon/godemonInfo"
76
"os"
7+
8+
"github.com/fatih/color"
89
)
910

1011
func HelpCLI() {
1112
version := godemonInfo.LoadVersion()
1213
color.Green("Godemon %v:", version)
13-
fmt.Printf("\nWhat flags do we have in Godemon? \n 1. Methods of godemon's runtime:" +
14-
"\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" +
15-
" 2. Other flags:\n a) -path - path to file or dir,\n b) -mod - specyfing that runtime option is using go modules,\n" +
16-
" c) -file - specyfing that runtime option is using single go file,\n d) -os - specyfing the GOOS,\n" +
17-
" e) -arch - specyfing the GOARCH,\n f) -name - specyfing the name of project/command/file\n" +
18-
" 3. project.json initialization and update:\n a) -init - initializating the project.json and go module,\n" +
19-
" b) -addCmd - adding command to project.json,\n c) -addFile - adding file to project.json") //("\n 1. -cnf <- in this flag put info about what do you want to do - if use cmd just -cmd option, if config file use -cnf \n2. -path <- path to file/directory \n 3. -modOrFile <- are you using modules or one file \n 4. -command <- binded command in config file \n 5. -name <- name of project \n 6. -os <- OS platform \n 7. -arch <- architecture \n 8. -init <- initializazition of project \n\n Have a problem? Go on my GitHub and see the README.md - https://github.com/Godemon-simplify-your-Go-programming/godemon \n")
14+
flag.Usage()
2015
os.Exit(1)
2116
}

0 commit comments

Comments
 (0)