Skip to content

Commit e5f5bc5

Browse files
committed
Godemon colors updated, and added new error handling
1 parent bc9466a commit e5f5bc5

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

controllers/functions.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package controllers
22

33
import (
4-
"fmt"
4+
"go/build"
55
"godemon/models"
6-
"os"
76
)
87

98
func ProgramStarting(cnf *string, filepath string, modOrFile string, command string, help *bool, version string, init bool, name string, oso string, arch string, hOS string) (string, string) {
@@ -15,14 +14,12 @@ func ProgramStarting(cnf *string, filepath string, modOrFile string, command str
1514
deploy(oso, arch, hOS)
1615
} else if init == true {
1716
if arch == "" && oso == "" {
18-
fmt.Println("\nPlease specify OS architecture and OS platform")
19-
os.Exit(1)
17+
arch = build.Default.GOARCH
18+
oso = build.Default.GOOS
2019
} else if arch == "" {
21-
fmt.Println("\nPlease specify OS architecture")
22-
os.Exit(1)
20+
arch = build.Default.GOARCH
2321
} else if oso == "" {
24-
fmt.Println("\nPlease specify OS platform")
25-
os.Exit(1)
22+
oso = build.Default.GOOS
2623
}
2724
initialize(name, arch, oso)
2825
} else if *help == true ||

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//TODO - refactore code to avoid using the Path parameter in project.json and while creating project
1+
// TODO - prepare the code to manage all errors that user can do
22

33
package main
44

@@ -18,7 +18,7 @@ import (
1818
func main() {
1919
hostInfo := [2]string{build.Default.GOOS, build.Default.GOARCH}
2020
color.Cyan("Godemon starting...")
21-
version := "2.6.0"
21+
version := "2.6.1"
2222
doneChan := make(chan bool)
2323
filepath, modOrFile, cnf, command, help, init, name, oso, arch := cliTools.LoadCMD("", "")
2424
filepath, modOrFile = controllers.ProgramStarting(&cnf, filepath, modOrFile, command, help, version, init, name, oso, arch, hostInfo[0])

models/staticCLI.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ package models
22

33
import (
44
"fmt"
5+
"github.com/fatih/color"
56
"os"
67
)
78

89
func HelpCLI(version string) {
9-
fmt.Printf("Godemon %v: \n 1. -cnf <- in this flag put info about what do you want to do - if use cmd option use -cnf=cmd, if config file use -cnf=cnf \n 2. -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/nProgrammer/godemon \n", version)
10+
color.Green("Godemon %v:", version)
11+
fmt.Println("\n 1. -cnf <- in this flag put info about what do you want to do - if use cmd option use -cnf=cmd, if config file use -cnf=cnf \n 2. -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/nProgrammer/godemon \n")
1012
os.Exit(1)
1113
}

0 commit comments

Comments
 (0)