summaryrefslogtreecommitdiff
path: root/theMagicOfAutocomplete.go
diff options
context:
space:
mode:
Diffstat (limited to 'theMagicOfAutocomplete.go')
-rw-r--r--theMagicOfAutocomplete.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/theMagicOfAutocomplete.go b/theMagicOfAutocomplete.go
index 13cf020..003a901 100644
--- a/theMagicOfAutocomplete.go
+++ b/theMagicOfAutocomplete.go
@@ -78,9 +78,11 @@ func Autocomplete(dest any) *Argv {
if !me.isAuto {
// not autocompleting. return to the application
// save the pb & history
- savePB()
+ // savePB()
// me.pp = arg.MustParse(dest)
me.Err = errors.Join(me.Err, me.mustParseFunc())
+ me.debug = true
+ doStdoutStderr()
return me.pb
}
@@ -136,6 +138,8 @@ func prepareStdout() {
me.debug = true
return
}
+ me.debug = true
+ doStdoutStderr()
if len(me.pb.Real) == 0 {
// error is normal if there are no command line args
@@ -196,7 +200,8 @@ func savePB() {
errors.Join(me.Err, me.all.Save())
}
-func saveAndExit() {
+func doStdoutStderr() {
+ savePB()
if me.debug {
me.all.PrintHistory(me.last.GetCmd())
me.pb.PrintStderr()
@@ -208,7 +213,10 @@ func saveAndExit() {
}
}
me.pb.PrintStdout()
- savePB()
+}
+
+func saveAndExit() {
+ doStdoutStderr()
os.Exit(0)
}