lib: Split off the CLI portions into a separate package

This cleans things up a bit more and forces the lib package to not
contain any accidental CLI parsing code.
This commit is contained in:
James Shubin
2024-02-22 19:50:44 -05:00
parent 70b5ed7067
commit abe3e0e7a5
8 changed files with 47 additions and 30 deletions

View File

@@ -55,6 +55,12 @@ import (
const (
// NS is the root namespace for etcd operations. All keys must use it!
NS = "/_mgmt" // must not end with a slash!
// MetadataPrefix is the etcd prefix where all our fs superblocks live.
MetadataPrefix = "/fs"
// StoragePrefix is the etcd prefix where all our fs data lives.
StoragePrefix = "/storage"
)
// Flags are some constant flags which are used throughout the program.
@@ -202,9 +208,6 @@ func (obj *Main) Run() error {
log.Printf("main: "+format, v...)
}
hello(obj.Program, obj.Version, obj.Flags) // say hello!
defer Logf("goodbye!")
exitCtx := obj.exit.Context() // local exit signal
defer obj.exit.Done(nil) // ensure this gets called even if Exit doesn't