summaryrefslogtreecommitdiff
path: root/theMagicOfAutocomplete.go
diff options
context:
space:
mode:
Diffstat (limited to 'theMagicOfAutocomplete.go')
-rw-r--r--theMagicOfAutocomplete.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/theMagicOfAutocomplete.go b/theMagicOfAutocomplete.go
index e1ad4d5..34ba8f7 100644
--- a/theMagicOfAutocomplete.go
+++ b/theMagicOfAutocomplete.go
@@ -30,6 +30,14 @@ func Autocomplete(dest any) *Auto {
arg.Register(&argBash)
arg.Register(&argGui)
+ // user is trying to setup bash or zsh autocomplete
+ // --bash or --zsh is the first os.Args
+ if pb.SetupAuto {
+ // --bash was passed. try to configure bash-completion
+ MakeAutocompleteFiles(myAuto.appName)
+ os.Exit(0)
+ }
+
// not autocompleting. return go-arg & the application
if !pb.IsAuto {
// save the pb & history
@@ -41,13 +49,6 @@ func Autocomplete(dest any) *Auto {
return pb
}
- // user is trying to setup bash or zsh autocomplete
- if pb.SetupAuto {
- // --bash was passed. try to configure bash-completion
- MakeAutocompleteFiles(myAuto.appName)
- os.Exit(0)
- }
-
// EVERYTHING PAST HERE IS FOR AUTOCOMPLETE
// everything sent to STDOUT and STDERR matters past this point