prepare to move all the GUI code out of main.go
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
6ddbe8c28d
commit
4d13b8abec
|
@ -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"))
|
||||
}
|
||||
|
|
|
@ -5,7 +5,9 @@ shell: ${SHELL}
|
|||
envKey1: ${NotExist|defValue}
|
||||
|
||||
map1:
|
||||
key: val2
|
||||
key1:
|
||||
jwc1: jcarr1
|
||||
jwc2: jcarr2
|
||||
key2: val20
|
||||
|
||||
arr1:
|
||||
|
|
14
main.go
14
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")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue