mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-29 06:35:07 +03:00
Added mest-ui start options and ability to enable debug console
This commit is contained in:
parent
7d7db57319
commit
70d32441c0
6 changed files with 45 additions and 4 deletions
|
@ -18,9 +18,32 @@ import (
|
|||
"github.com/webview/webview"
|
||||
|
||||
"github.com/RiV-chain/RiV-mesh/src/admin"
|
||||
"github.com/docopt/docopt-go"
|
||||
)
|
||||
|
||||
var confui struct {
|
||||
Console bool `docopt:"-c,--console"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
usage := `Graphical interface for RiV mesh.
|
||||
|
||||
Usage:
|
||||
mesh-ui
|
||||
mesh-ui -c | --console
|
||||
mesh-ui -h | --help
|
||||
mesh-ui -v | --version
|
||||
|
||||
Options:
|
||||
-c --console Show debug console window.
|
||||
-h --help Show this screen.
|
||||
-v --version Show version.`
|
||||
|
||||
opts, _ := docopt.ParseArgs(usage, os.Args[1:], "0.0.1")
|
||||
opts.Bind(&confui)
|
||||
if !confui.Console {
|
||||
Console(false)
|
||||
}
|
||||
debug := true
|
||||
w := webview.New(debug)
|
||||
defer w.Destroy()
|
||||
|
|
|
@ -30,3 +30,6 @@ func run_command_with_arg(command string, arg string) []byte {
|
|||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func Console(show bool) {
|
||||
}
|
||||
|
|
|
@ -33,3 +33,19 @@ func run_command_with_arg(command string, arg string) []byte {
|
|||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func Console(show bool) {
|
||||
var getWin = syscall.NewLazyDLL("kernel32.dll").NewProc("GetConsoleWindow")
|
||||
var showWin = syscall.NewLazyDLL("user32.dll").NewProc("ShowWindow")
|
||||
hwnd, _, _ := getWin.Call()
|
||||
if hwnd == 0 {
|
||||
return
|
||||
}
|
||||
if show {
|
||||
var SW_RESTORE uintptr = 9
|
||||
showWin.Call(hwnd, SW_RESTORE)
|
||||
} else {
|
||||
var SW_HIDE uintptr = 0
|
||||
showWin.Call(hwnd, SW_HIDE)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue