parent
14199d588e
commit
6fba083fdd
19
config.go
19
config.go
|
@ -25,6 +25,7 @@ import "github.com/gookit/config/json"
|
|||
|
||||
// always override the debugging flag from the command line
|
||||
var debugging *bool
|
||||
var debugtable *bool
|
||||
|
||||
var customUsage = func() {
|
||||
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
|
||||
|
@ -38,17 +39,15 @@ var customUsage = func() {
|
|||
}
|
||||
|
||||
func parseFlags() {
|
||||
var version string
|
||||
var hostname string
|
||||
var height int
|
||||
|
||||
flag.StringVar (&version, "version", "v0.1", "Set compiled in version string")
|
||||
flag.StringVar (&hostname, "hostname", "localhost", "Your full hostname")
|
||||
flag.IntVar (&height, "height", 600, "Height of the Window")
|
||||
|
||||
width := flag.Int ("width", 400, "Width of the Window")
|
||||
debugging = flag.Bool("debugging", false, "Enable debugging")
|
||||
nogui := flag.Bool("nogui", false, "Do not display the GUI")
|
||||
height := flag.Int ("height", 600, "Width of the Window")
|
||||
width := flag.Int ("width", 400, "Width of the Window")
|
||||
debugging = flag.Bool("debugging", false, "Enable debugging")
|
||||
debugtable = flag.Bool("debugtable", false, "Enable GUI table debugging")
|
||||
nogui := flag.Bool("nogui", false, "Do not display the GUI")
|
||||
|
||||
// Set the output if something fails to stdout rather than stderr
|
||||
flag.CommandLine.SetOutput(os.Stdout)
|
||||
|
@ -81,6 +80,7 @@ func parseFlags() {
|
|||
config.Set("hostname", hostname)
|
||||
config.Set("nogui", *nogui)
|
||||
config.Set("debugging", *debugging)
|
||||
|
||||
log.Println("config.Set width", config.String("width"))
|
||||
log.Println("config.Set debugging", config.Bool("debugging"))
|
||||
}
|
||||
|
@ -125,8 +125,9 @@ func parseConfig(defaultConfig string) {
|
|||
filename := config.String("configfile")
|
||||
config.LoadFiles(filename)
|
||||
|
||||
// always override the debugging flag from the command line
|
||||
config.Set("debugging", *debugging)
|
||||
// always override the JSON config file debugging flags from the command line
|
||||
config.Set("debugging", *debugging)
|
||||
config.Set("debugtable", *debugtable)
|
||||
|
||||
for account, _ := range config.StringMap("cloud") {
|
||||
port := config.String("accounts." + account + ".port")
|
||||
|
|
10
main.go
10
main.go
|
@ -107,11 +107,14 @@ func main() {
|
|||
gui.Data.GitCommit = GITCOMMIT
|
||||
gui.Data.GoVersion = GOVERSION
|
||||
gui.Data.Buildtime = BUILDTIME
|
||||
gui.Data.ButtonClick = buttonClick
|
||||
gui.Data.MouseClick = buttonClick
|
||||
gui.Data.HomeDir = user.HomeDir
|
||||
|
||||
// Set output debugging level
|
||||
gui.Data.Debug = config.Bool("debugging")
|
||||
log.Println("config Bool debugging = ", config.Bool("debugging"))
|
||||
gui.Data.DebugTable = config.Bool("debugtable")
|
||||
log.Println("gui.Data.Debug = ", gui.Data.Debug)
|
||||
log.Println("gui.Data.DebugTable = ", gui.Data.DebugTable)
|
||||
|
||||
// Current User
|
||||
log.Println("Hi " + user.Name + " (id: " + user.Uid + ")")
|
||||
|
@ -131,8 +134,9 @@ func buttonClick(b *gui.ButtonMap) {
|
|||
log.Println("buttonClick() b =", b)
|
||||
|
||||
if (b == nil) {
|
||||
log.Println("THIS MOUSE EVENT WAS NOT FROM A BUTTON")
|
||||
log.Println("main() BACK IN CONTROL PANEL CODE (button is nil)")
|
||||
} else {
|
||||
log.Println("main() BACK IN CONTROL PANEL CODE (button is ", b.Name, ")")
|
||||
log.Println("\tb.Name", b.Name)
|
||||
log.Println("\tb.Note", b.Note)
|
||||
log.Println("\tb.AccNick", b.AccNick)
|
||||
|
|
Loading…
Reference in New Issue