File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -84,14 +84,19 @@ func initConfig() {
8484
8585 GetCredentials ()
8686
87- generateBashCompletion ()
87+ if os .Getenv ("GENERATE_BASH_COMPLETION" ) != "" {
88+ if err := generateBashCompletion (); err != nil {
89+ fmt .Printf ("Error generating Bash completion: %v" , err )
90+ }
91+ }
8892}
8993
90- func generateBashCompletion () {
91- file , err2 := os .Create ("/tmp/pgo-bash-completion.out" )
92- if err2 != nil {
93- fmt .Println ("Error: " , err2 .Error ())
94+ func generateBashCompletion () error {
95+ log .Debugf ("generating bash completion script" )
96+ file , err := os .Create ("/tmp/pgo-bash-completion.out" )
97+ if err != nil {
98+ return err
9499 }
95100 defer file .Close ()
96- RootCmd .GenBashCompletion (file )
101+ return RootCmd .GenBashCompletion (file )
97102}
You can’t perform that action at this time.
0 commit comments