cli-plugins/metadata: Add Features for optional plugin contracts

Plugins had no generic way to declare support for optional CLI
contracts, so each one would need its own top-level metadata field.

Add Features, keyed by feature name. Values are arbitrary JSON so a
feature can carry more than a boolean.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski
2026-10-01 19:04:25 +02:00
parent 7fc2dff9bc
commit b1f2c1dc06
+6
View File
@@ -1,3 +1,6 @@
// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
//go:build go1.26
package metadata
const (
@@ -35,4 +38,7 @@ type Metadata struct {
URL string `json:",omitempty"`
// Hidden hides the plugin in completion and help message output.
Hidden bool `json:",omitempty"`
// Features declares optional contracts supported by the plugin, keyed by
// feature name.
Features map[string]any `json:",omitempty"`
}