MCPcopy Create free account
hub / github.com/docker/cli / TestHiddenPlugin

Function TestHiddenPlugin

cli/cobra_test.go:59–84  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

57}
58
59func TestHiddenPlugin(t *testing.T) {
60 root := &cobra.Command{Use: "root"}
61 sub1 := &cobra.Command{
62 Use: "sub1",
63 Hidden: true,
64 Annotations: map[string]string{
65 metadata.CommandAnnotationPlugin: "true",
66 },
67 Run: func(cmd *cobra.Command, args []string) {},
68 }
69
70 sub1sub1 := &cobra.Command{Use: "sub1sub1"}
71 sub1sub2 := &cobra.Command{Use: "sub1sub2"}
72 sub2 := &cobra.Command{
73 Use: "sub2",
74 Annotations: map[string]string{
75 metadata.CommandAnnotationPlugin: "true",
76 },
77 Run: func(cmd *cobra.Command, args []string) {},
78 }
79
80 root.AddCommand(sub1, sub2)
81 sub1.AddCommand(sub1sub1, sub1sub2)
82
83 assert.DeepEqual(t, allManagementSubCommands(root), []*cobra.Command{sub2}, cmpopts.IgnoreFields(cobra.Command{}, "Run"), cmpopts.IgnoreUnexported(cobra.Command{}))
84}
85
86func TestCommandAliases(t *testing.T) {
87 root := &cobra.Command{Use: "root"}

Callers

nothing calls this directly

Calls 1

allManagementSubCommandsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…