Skip to content

Commit c9fdb9a

Browse files
committed
bugs fixed
1 parent 2a2f2d3 commit c9fdb9a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

cliTools/loadFlags.go

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

9-
func LoadCMD(filepath string, modOrFile string) (string, string, string, string, *bool, bool, string, string, string) {
9+
func LoadCMD(filepath string, modOrFile string) (string, string, string, string, *bool, bool, string, string, string, string) {
1010
var filepathP *string
1111
var modOrFileP *string
1212
cnfP := flag.String("cnf", "", "a string")
@@ -27,8 +27,10 @@ func LoadCMD(filepath string, modOrFile string) (string, string, string, string,
2727
arch := *archP
2828
command := *commandP
2929
modOrFile = *modOrFileP
30+
cont := ""
3031
if init == true && name == "" {
3132
color.Red("Missing parameter: -name")
33+
cont = "Exit"
3234
} else if init == true {
3335
if arch == "" && os == "" {
3436
arch = build.Default.GOARCH
@@ -39,5 +41,5 @@ func LoadCMD(filepath string, modOrFile string) (string, string, string, string,
3941
os = build.Default.GOOS
4042
}
4143
}
42-
return filepath, modOrFile, cnf, command, helpP, init, name, os, arch
44+
return filepath, modOrFile, cnf, command, helpP, init, name, os, arch, cont
4345
}

main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ func main() {
2323
version := "21.03"
2424
color.HiMagenta("Welcome to godemon " + version)
2525
doneChan := make(chan bool)
26-
filepath, modOrFile, cnf, command, help, init, name, oso, arch := cliTools.LoadCMD("", "")
26+
filepath, modOrFile, cnf, command, help, init, name, oso, arch, cont := cliTools.LoadCMD("", "")
27+
if cont == "Exit" {
28+
os.Exit(1)
29+
}
2730
filepath, modOrFile = controllers.ProgramStarting(&cnf, filepath, modOrFile, command, help, version, init, name, oso, arch, hostInfo[0])
2831
for true {
2932
go func(doneChan chan bool) {

0 commit comments

Comments
 (0)