summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-26 08:29:43 -0500
committerJeff Carr <[email protected]>2025-10-26 08:29:43 -0500
commit4684799ca211b13b821a51cb0b3c87e43bd95aa8 (patch)
treefc23a62eed2b8d091e135c69f7e90bd6df24ff31 /main.go
parent213d7bd6749471c583534e76f9c29c5b0183a4cb (diff)
new argv design
Diffstat (limited to 'main.go')
-rw-r--r--main.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/main.go b/main.go
index e972da0..c25d5e5 100644
--- a/main.go
+++ b/main.go
@@ -17,18 +17,17 @@ var resources embed.FS
func main() {
me = new(mainType)
- // autocomplete must be processed before there is anything sent to STDOUT or STDERR
- me.argv = argvpb.Autocomplete(&argv) // adds shell auto complete to go-args
- me.homedir, _ = os.UserHomeDir() // store shortcut here todo: add better logic
+ argvpb.Init(&argv, APPNAME, BUILDTIME, VERSION) // adds shell auto-complete
+ me.homedir, _ = os.UserHomeDir() // store shortcut here todo: add better logic
- if me.argv.GetCmd() == "" {
+ if argvpb.GetCmd() == "" {
// user didn't enter a sub command
// doDefaultBehavior()
- me.argv.GoodExit("do what?")
+ argvpb.GoodExit("do what?")
}
pwd, _ := os.Getwd()
- setTitle(log.Sprintf("wit %s %s", me.argv.GetCmd(), pwd))
+ setTitle(log.Sprintf("wit %s %s", argvpb.GetCmd(), pwd))
// Standard subcommand handling starts here
var s string
@@ -40,10 +39,10 @@ func main() {
// argv provides timing and other features on exit
if err != nil {
// bad exit back to the shell via argv
- me.argv.BadExit(s, err)
+ argvpb.BadExit(s, err)
}
// a good exit back to the shell via argv
- me.argv.GoodExit(s)
+ argvpb.GoodExit(s)
}
// this is dumb. sync this with go-deb