@@ -84,16 +84,16 @@ func New(cliargs []string) ContextExecutor {
84
84
_ = cmd .Flags ().Set (f .Name , fmt .Sprintf ("%v" , v .Get (f .Name )))
85
85
}
86
86
})
87
-
88
87
// unhide params
89
88
switch {
90
89
case bashCompletion ,
91
90
zshCompletion ,
92
91
fishCompletion ,
93
92
powershellCompletion ,
94
93
cmd .Name () == "__complete" :
94
+ flags := cmd .Root ().Flags ()
95
95
for _ , name := range []string {"no-psqlrc" , "no-usqlrc" , "var" , "variable" } {
96
- cmd . Root (). Flags () .Lookup (name ).Hidden = false
96
+ flags .Lookup (name ).Hidden = false
97
97
}
98
98
}
99
99
return nil
@@ -118,7 +118,6 @@ func New(cliargs []string) ContextExecutor {
118
118
case badHelp :
119
119
return errors .New ("unknown shorthand flag: 'h' in -h" )
120
120
}
121
-
122
121
// run
123
122
if len (cliargs ) > 0 {
124
123
args .DSN = cliargs [0 ]
@@ -184,7 +183,7 @@ func New(cliargs []string) ContextExecutor {
184
183
// set bools
185
184
ss (& args .Variables , "quiet" , "q" , "run quietly (no messages, only query output)" , "" , "QUIET=on" )
186
185
187
- // add config
186
+ // app config
188
187
_ = flags .StringP ("config" , "" , "" , "config file" )
189
188
190
189
// manually set --version, see github.com/spf13/cobra/command.go
@@ -211,9 +210,7 @@ func New(cliargs []string) ContextExecutor {
211
210
"completion-script-powershell" , "no-descriptions" ,
212
211
"bad-help" ,
213
212
} {
214
- if err := flags .MarkHidden (name ); err != nil {
215
- panic (err )
216
- }
213
+ flags .Lookup (name ).Hidden = true
217
214
}
218
215
return c
219
216
}
0 commit comments