From 4d13b8abec1f6157247359fd08a794500dea9ad2 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 6 May 2019 18:57:59 -0700 Subject: [PATCH] prepare to move all the GUI code out of main.go Signed-off-by: Jeff Carr --- config.go | 6 ++++++ config.yml | 4 +++- main.go | 14 +++++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/config.go b/config.go index d409ccf..748a9b7 100644 --- a/config.go +++ b/config.go @@ -17,6 +17,8 @@ import "fmt" import "github.com/gookit/config" import "github.com/gookit/config/yaml" +// import "github.com/davecgh/go-spew/spew" + var customUsage = func() { fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0]) flag.PrintDefaults() @@ -85,4 +87,8 @@ func parseConfig() { log.Println("addr =", addr) } + map1 := config.StringMap("map1") + fmt.Printf("%#v\n",map1) + + log.Println(config.String("map1.key1.jwc1")) } diff --git a/config.yml b/config.yml index 2b05e48..21e1d29 100644 --- a/config.yml +++ b/config.yml @@ -5,7 +5,9 @@ shell: ${SHELL} envKey1: ${NotExist|defValue} map1: - key: val2 + key1: + jwc1: jcarr1 + jwc2: jcarr2 key2: val20 arr1: diff --git a/main.go b/main.go index 138525a..a966ce8 100644 --- a/main.go +++ b/main.go @@ -4,7 +4,7 @@ import "log" import "io/ioutil" import "fmt" import "github.com/mitchellh/go-homedir" -// import "os" +import "os" import "strings" import "time" @@ -12,6 +12,8 @@ import "github.com/gookit/config" import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" +import "github.com/davecgh/go-spew/spew" + // dns // import "github.com/miekg/dns" @@ -287,7 +289,13 @@ func setupUI() { func main() { parseConfig() - time.Sleep(2 * 1000 * 1000 * 1000) - 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") }