[mike@mwxm4]

This commit is contained in:
2026-05-21 15:37:44 +02:00
parent ddbfcc1093
commit 7fa27818cc
3 changed files with 50 additions and 43 deletions
+9 -5
View File
@@ -29,7 +29,7 @@ import (
"github.com/tidwall/gjson"
)
var tbversion = "0.4.1"
var tbversion = "0.4.3"
var CHRS = "VW9IdGJ6eXh1T25DRHdrc2M5MlhOQVNQcEJFWnJhWVY2ZEowaFJLdmoxNUdxVDRJZkZpTTdRZW0zTFc4Z2w="
var LR = []rune("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
@@ -48,7 +48,8 @@ func checkforupdate() { // -----------------------------------------------------
sv_lversion, err := semver.NewVersion(lversion)
if err == nil {
if (sv_lversion.GreaterThan(sv_version)) {
ans:=Yesno(SF("new '%s' version found (%s -> %s), update now?",prg,sv_version,sv_lversion),true);
ans:=Yesno(SF("new '%s' version found (%s -> %s), update now?",
prg,sv_version,sv_lversion),true,false);
if (ans) {
updateurl:=SF("%s/%s_%s_%s_%s",UPDATEBASEURL,prg,lversion,runtime.GOOS,runtime.GOARCH)
@@ -127,7 +128,10 @@ func Inputpw(msg string) string { // ---------------------------------------- Al
return tmp
}
func Yesno(msg string, def bool) bool { // ------------------------------------------ AlecAivazis/survey: yes/no
func Yesno(msg string, def bool, overwrite bool) bool { // -------------------------- AlecAivazis/survey: yes/no
if (overwrite) { return true }
var err error
tmp := ""
if def {
@@ -263,11 +267,11 @@ func SF(format string, a ...any) string { return fmt.Sprintf(format,
func PE(msg ...string) (n int, err error) {
if (len(msg)==2) { return fmt.Fprintf(os.Stdout, "%s: %s (%s)\n", Crb("ERROR"), Cwb(msg[0]),msg[1]) }
return fmt.Fprintf(os.Stdout, "%s: %s\n", Crb("ERROR"), Cwb(msg))
return fmt.Fprintf(os.Stdout, "%s: %s\n", Crb("ERROR"), Cwb(msg[0]))
}
func PO(msg ...string) (n int, err error) {
if (len(msg)==2) { return fmt.Fprintf(os.Stdout, "%s: %s (%s)\n", Cgb("OK"), Cwb(msg[0]),msg[1]) }
return fmt.Fprintf(os.Stdout, "%s: %s\n", Cgb("OK"), Cwb(msg))
return fmt.Fprintf(os.Stdout, "%s: %s\n", Cgb("OK"), Cwb(msg[0]))
}
// ------------------------------------------------------------------------------------------ regular expression