summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go37
1 files changed, 15 insertions, 22 deletions
diff --git a/main.go b/main.go
index cd70401..1a6d575 100644
--- a/main.go
+++ b/main.go
@@ -13,19 +13,12 @@ import (
"go.wit.com/log"
)
-// sent via -ldflags
-var VERSION string
-var BUILDTIME string
-
-// used for shell auto completion
-var ARGNAME string = "mirrors" // todo: get this from $0
-
//go:embed resources/*
var resources embed.FS
func main() {
me = new(mainType)
- me.sh = argvpb.Autocomplete(&argv) // adds shell auto complete to go-args
+ me.argv = argvpb.Autocomplete(&argv) // adds shell auto complete to go-args
// read in protobuf file
me.pb = zoopb.NewPackages()
@@ -33,7 +26,7 @@ func main() {
if err := me.pb.Load(); err != nil {
me.pb.BaseDir = config.GetPanic("BaseDir")
me.pb.Save()
- me.sh.GoodExit("created new pb file: " + me.pb.Filename + ". rerun mirrors.")
+ me.argv.GoodExit("created new pb file: " + me.pb.Filename + ". rerun mirrors.")
}
// force check the PB variable
@@ -41,32 +34,32 @@ func main() {
if me.pb.BaseDir != config.GetPanic("BaseDir") {
me.pb.BaseDir = config.GetPanic("BaseDir")
me.pb.Save()
- me.sh.BadExit("pb.BaseDir is bank", nil)
+ me.argv.BadExit("pb.BaseDir is bank", nil)
}
if err := os.Chdir(me.pb.BaseDir); err != nil {
- me.sh.BadExit("no '"+me.pb.BaseDir+"' directory", err)
+ me.argv.BadExit("no '"+me.pb.BaseDir+"' directory", err)
}
if !shell.IsDir("pool/") {
- me.sh.BadExit("no "+filepath.Join(me.pb.BaseDir, "pool")+" directory", errors.New("mount -a ? missing wit/pool/"))
+ me.argv.BadExit("no "+filepath.Join(me.pb.BaseDir, "pool")+" directory", errors.New("mount -a ? missing wit/pool/"))
}
- if me.sh.Cmd == "" {
+ if me.argv.Cmd == "" {
// STANDARD START
// walk for new .deb files
s, err := doWalk()
if err != nil {
- me.sh.BadExit(s, err)
+ me.argv.BadExit(s, err)
}
// move files from inccoming into pooo/
s, err = doIncoming(me.pb)
if err != nil {
- me.sh.BadExit(s, err)
+ me.argv.BadExit(s, err)
}
- me.sh.GoodExit(s)
+ me.argv.GoodExit(s)
// STANDARD START END
}
@@ -106,19 +99,19 @@ func main() {
// move files to the right place
s, err = doIncoming(me.pb)
if err != nil {
- me.sh.BadExit(s, err)
+ me.argv.BadExit(s, err)
}
// add the filenames to the .pb
s, err = doWalk()
if err != nil {
- me.sh.BadExit(s, err)
+ me.argv.BadExit(s, err)
}
// verify all the packages
s, err = doVerify()
if err != nil {
- me.sh.BadExit(s, err)
+ me.argv.BadExit(s, err)
}
// print a table of the newest packages
@@ -128,7 +121,7 @@ func main() {
err = doPurge()
if err != nil {
- me.sh.BadExit("could not purge dists/", err)
+ me.argv.BadExit("could not purge dists/", err)
}
// make and GPG sign the Release files
@@ -160,7 +153,7 @@ func main() {
*/
if err != nil {
- me.sh.BadExit(s, err)
+ me.argv.BadExit(s, err)
}
- me.sh.GoodExit(s)
+ me.argv.GoodExit(s)
}