Refactoring code to prep for UI devlopment
Im procrastinating...
This commit is contained in:
@@ -7,8 +7,6 @@ import (
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
const fmConfig = "config.yml"
|
||||
|
||||
type GoConfig struct {
|
||||
Config struct {
|
||||
ServDir string `yaml:"serverFolder"`
|
||||
|
||||
BIN
factoryman
BIN
factoryman
Binary file not shown.
22
main.go
22
main.go
@@ -5,14 +5,10 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
var c = readCfg(fmConfig)
|
||||
var c = readCfg("config.yml")
|
||||
|
||||
func main() {
|
||||
if len(os.Args) == 1 {
|
||||
fmt.Println("Use 'start', 'stop', or 'backup' command")
|
||||
fmt.Println("ex. factoryman start")
|
||||
fmt.Println("To configure edit 'conifg.yml'")
|
||||
} else if len(os.Args) > 1 {
|
||||
func cli() {
|
||||
if len(os.Args) > 1 {
|
||||
switch os.Args[1] {
|
||||
case "start":
|
||||
startStopServer("start", c)
|
||||
@@ -44,3 +40,15 @@ func main() {
|
||||
fmt.Println("To configure edit 'conifg.yml'")
|
||||
}
|
||||
}
|
||||
|
||||
func switchMode() { // cli command mode or GUI mode
|
||||
if len(os.Args) == 1 {
|
||||
fmt.Println("Starting GUI mode...")
|
||||
} else if len(os.Args) > 1 {
|
||||
cli()
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
switchMode()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user