(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func 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 | |
| 86 | func TestCommandAliases(t *testing.T) { |
| 87 | root := &cobra.Command{Use: "root"} |
nothing calls this directly
no test coverage detected
searching dependent graphs…