Refactoring code to prep for UI devlopment
Im procrastinating...
This commit is contained in:
@@ -7,8 +7,6 @@ import (
|
|||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
const fmConfig = "config.yml"
|
|
||||||
|
|
||||||
type GoConfig struct {
|
type GoConfig struct {
|
||||||
Config struct {
|
Config struct {
|
||||||
ServDir string `yaml:"serverFolder"`
|
ServDir string `yaml:"serverFolder"`
|
||||||
|
|||||||
BIN
factoryman
BIN
factoryman
Binary file not shown.
22
main.go
22
main.go
@@ -5,14 +5,10 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
var c = readCfg(fmConfig)
|
var c = readCfg("config.yml")
|
||||||
|
|
||||||
func main() {
|
func cli() {
|
||||||
if len(os.Args) == 1 {
|
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 {
|
|
||||||
switch os.Args[1] {
|
switch os.Args[1] {
|
||||||
case "start":
|
case "start":
|
||||||
startStopServer("start", c)
|
startStopServer("start", c)
|
||||||
@@ -44,3 +40,15 @@ func main() {
|
|||||||
fmt.Println("To configure edit 'conifg.yml'")
|
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