gui: add help option to show driver versions
This commit is contained in:
parent
70db402cdf
commit
2b309fbda7
31
main.go
31
main.go
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"runtime/debug"
|
||||||
"strings"
|
"strings"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
@ -118,6 +119,11 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
|
|||||||
mnuHelp := vcl.NewMenuItem(f)
|
mnuHelp := vcl.NewMenuItem(f)
|
||||||
mnuHelp.SetCaption("Help")
|
mnuHelp.SetCaption("Help")
|
||||||
|
|
||||||
|
mnuHelpVersion := vcl.NewMenuItem(mnuHelp)
|
||||||
|
mnuHelpVersion.SetCaption("Driver versions...")
|
||||||
|
mnuHelpVersion.SetOnClick(f.OnMenuHelpVersion)
|
||||||
|
mnuHelp.Add(mnuHelpVersion)
|
||||||
|
|
||||||
mnuHelpHomepage := vcl.NewMenuItem(mnuHelp)
|
mnuHelpHomepage := vcl.NewMenuItem(mnuHelp)
|
||||||
mnuHelpHomepage.SetCaption("About yvbolt")
|
mnuHelpHomepage.SetCaption("About yvbolt")
|
||||||
mnuHelpHomepage.SetShortCutFromString("F1")
|
mnuHelpHomepage.SetShortCutFromString("F1")
|
||||||
@ -319,6 +325,31 @@ func (f *TMainForm) OnMnuHelpHomepage(sender vcl.IObject) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *TMainForm) OnMenuHelpVersion(sender vcl.IObject) {
|
||||||
|
|
||||||
|
bi, ok := debug.ReadBuildInfo()
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
info := "This version of yvbolt was compiled with:\n"
|
||||||
|
for _, dep := range bi.Deps {
|
||||||
|
|
||||||
|
// Filter to only interesting things
|
||||||
|
switch dep.Path {
|
||||||
|
case `github.com/cockroachdb/pebble`,
|
||||||
|
`github.com/dgraph-io/badger/v4`,
|
||||||
|
`github.com/mattn/go-sqlite3`,
|
||||||
|
`github.com/redis/go-redis/v9`,
|
||||||
|
`go.etcd.io/bbolt`,
|
||||||
|
`modernc.org/sqlite`:
|
||||||
|
info += fmt.Sprintf("- %s %s\n", dep.Path, dep.Version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vcl.ShowMessage(info)
|
||||||
|
}
|
||||||
|
|
||||||
func (f *TMainForm) OnNavContextPopup(sender vcl.IObject, mousePos types.TPoint, handled *bool) {
|
func (f *TMainForm) OnNavContextPopup(sender vcl.IObject, mousePos types.TPoint, handled *bool) {
|
||||||
*handled = true
|
*handled = true
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user