File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,12 @@ func (c Command) NameAndAliases() []string {
111
111
// Method is used when defining the Flags in command metadata. @see Plugin#GetMetadata() for use case
112
112
func ConvertCobraFlagsToPluginFlags (cmd * cobra.Command ) []Flag {
113
113
var flags []Flag
114
+ // NOTE: there is a strange behavior in Cobra where you need to call
115
+ // either `InheritedFlags` or `LocalFlags` in order to include global
116
+ // flags when calling `VisitAll`
117
+ // see https://github.com/spf13/cobra/issues/412
118
+ cmd .InheritedFlags ()
119
+
114
120
cmd .Flags ().VisitAll (func (f * pflag.Flag ) {
115
121
var name string
116
122
if f .Shorthand != "" {
Original file line number Diff line number Diff line change @@ -221,6 +221,10 @@ func (ui *FakeUI) Writer() io.Writer {
221
221
return & ui .stdOut
222
222
}
223
223
224
+ func (ui * FakeUI ) ErrWriter () io.Writer {
225
+ return & ui .stdErr
226
+ }
227
+
224
228
func (ui * FakeUI ) SetQuiet (quiet bool ) {
225
229
ui .quiet = quiet
226
230
}
You can’t perform that action at this time.
0 commit comments