prepare to move all the GUI code out of main.go

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-06 18:57:59 -07:00
parent 6ddbe8c28d
commit 4d13b8abec
3 changed files with 20 additions and 4 deletions

View File

@ -17,6 +17,8 @@ import "fmt"
import "github.com/gookit/config" import "github.com/gookit/config"
import "github.com/gookit/config/yaml" import "github.com/gookit/config/yaml"
// import "github.com/davecgh/go-spew/spew"
var customUsage = func() { var customUsage = func() {
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0]) fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
flag.PrintDefaults() flag.PrintDefaults()
@ -85,4 +87,8 @@ func parseConfig() {
log.Println("addr =", addr) log.Println("addr =", addr)
} }
map1 := config.StringMap("map1")
fmt.Printf("%#v\n",map1)
log.Println(config.String("map1.key1.jwc1"))
} }

View File

@ -5,7 +5,9 @@ shell: ${SHELL}
envKey1: ${NotExist|defValue} envKey1: ${NotExist|defValue}
map1: map1:
key: val2 key1:
jwc1: jcarr1
jwc2: jcarr2
key2: val20 key2: val20
arr1: arr1:

14
main.go
View File

@ -4,7 +4,7 @@ import "log"
import "io/ioutil" import "io/ioutil"
import "fmt" import "fmt"
import "github.com/mitchellh/go-homedir" import "github.com/mitchellh/go-homedir"
// import "os" import "os"
import "strings" import "strings"
import "time" import "time"
@ -12,6 +12,8 @@ import "github.com/gookit/config"
import "github.com/andlabs/ui" import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest" import _ "github.com/andlabs/ui/winmanifest"
import "github.com/davecgh/go-spew/spew"
// dns // dns
// import "github.com/miekg/dns" // import "github.com/miekg/dns"
@ -287,7 +289,13 @@ func setupUI() {
func main() { func main() {
parseConfig() parseConfig()
time.Sleep(2 * 1000 * 1000 * 1000)
ui.Main(setupUI) ui.Main(setupUI)
log.Println("Sleep for 1 second")
time.Sleep(1 * 1000 * 1000 * 1000)
f, err := os.Create("/tmp/cloud-control-panel-test")
spew.Dump(err)
config.DumpTo(f, "yaml")
} }