// Copyright 2017-2025 WIT.COM Inc. All rights reserved. // Use of this source code is governed by the GPL 3.0 package main import ( "embed" "os" "unicode" "go.wit.com/lib/gui/prep" ) // sent via -ldflags var VERSION string var BUILDTIME string // used for shell auto completion var ARGNAME string = "wit" // todo: get this from $0 ? //go:embed resources/* var resources embed.FS func main() { me = new(mainType) // autocomplete must be processed before there is anything sent to STDOUT or STDERR me.sh = prep.Bash3(&argv) // add support for bash autocomplete with go-arg me.homedir, _ = os.UserHomeDir() // store shortcut here todo: add better logic if argv.Upgrade != nil { doUpgrade() me.sh.GoodExit("") } if argv.Rdate != nil { doRdate() me.sh.GoodExit("") } if argv.Build != nil { doBuild() me.sh.GoodExit("") } if argv.Git != nil { s, err := doGit() if err != nil { me.sh.BadExit(s, err) } me.sh.GoodExit(s) } if argv.Clone != nil { doClone() me.sh.GoodExit("") } if argv.WITCOM { doWITCOM() me.sh.GoodExit("") } if argv.Upgrade != nil { doUpgrade() } if argv.Publish != nil { if err := doPublish(); err != nil { me.sh.BadExit("doPublish failed", err) } me.sh.GoodExit("") } if argv.Zoo != nil { if areSuperuser() { exitOnErrorRealtime([]string{"journalctl", "-n", "100", "-f", "_SYSTEMD_UNIT=zood.service"}) } me.sh.GoodExit("do something here") } me.sh.GoodExit("do what?") } // this is dumb. sync this with go-deb func trimNonNumericFromStart(s string) string { for i, r := range s { if unicode.IsDigit(r) { return s[i:] } } return "" }