(cmd *cobra.Command, plugin Plugin)
| 27 | ) |
| 28 | |
| 29 | func getPluginResourceAttributes(cmd *cobra.Command, plugin Plugin) attribute.Set { |
| 30 | commandPath := cmd.Annotations[metadata.CommandAnnotationPluginCommandPath] |
| 31 | if commandPath == "" { |
| 32 | commandPath = fmt.Sprintf("%s %s", cmd.CommandPath(), plugin.Name) |
| 33 | } |
| 34 | |
| 35 | attrSet := attribute.NewSet( |
| 36 | cobraCommandPath.String(commandPath), |
| 37 | ) |
| 38 | |
| 39 | kvs := make([]attribute.KeyValue, 0, attrSet.Len()) |
| 40 | for iter := attrSet.Iter(); iter.Next(); { |
| 41 | attr := iter.Attribute() |
| 42 | kvs = append(kvs, attribute.KeyValue{ |
| 43 | Key: dockerCLIAttributePrefix + attr.Key, |
| 44 | Value: attr.Value, |
| 45 | }) |
| 46 | } |
| 47 | return attribute.NewSet(kvs...) |
| 48 | } |
| 49 | |
| 50 | func appendPluginResourceAttributesEnvvar(env []string, cmd *cobra.Command, plugin Plugin) []string { |
| 51 | if attrs := getPluginResourceAttributes(cmd, plugin); attrs.Len() > 0 { |
no test coverage detected
searching dependent graphs…