MCPcopy Index your code
hub / github.com/cli/cli / TestManPrintFlagsHidesShortDeprecated

Function TestManPrintFlagsHidesShortDeprecated

internal/docs/man_test.go:157–170  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

155}
156
157func TestManPrintFlagsHidesShortDeprecated(t *testing.T) {
158 c := &cobra.Command{}
159 c.Flags().StringP("foo", "f", "default", "Foo flag")
160 _ = c.Flags().MarkShorthandDeprecated("foo", "don't use it no more")
161
162 buf := new(bytes.Buffer)
163 manPrintFlags(buf, c.Flags())
164
165 got := buf.String()
166 expected := "`--foo` `<string> (default \"default\")`\n: Foo flag\n\n"
167 if got != expected {
168 t.Errorf("Expected %q, got %q", expected, got)
169 }
170}
171
172func TestGenManTree(t *testing.T) {
173 c := &cobra.Command{Use: "do [OPTIONS] arg1 arg2"}

Callers

nothing calls this directly

Calls 3

manPrintFlagsFunction · 0.85
ErrorfMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected