DockerCLI/cli-plugins
Laura Brehm 9d8320de9d
hooks: include full configured command
Before, for plugin commands, only the plugin name (such as `buildx`)
would be both included as `RootCmd` when passed to the hook plugin,
which isn't enough information for a plugin to decide whether to execute
a hook or not since plugins implement multiple varied commands (`buildx
build`, `buildx prune`, etc.).

This commit changes the hook logic to account for this situation, so
that the the entire configured hook is passed, i.e., if a user has a
hook configured for `buildx imagetools inspect` and the command
`docker buildx imagetools inspect alpine` is called, then the plugin
hooks will be passed `buildx imagetools inspect`.

This logic works for aliased commands too, so whether `docker build ...`
or `docker buildx build` is executed (unless Buildx is disabled) the
hook will be invoked with `buildx build`.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>

hooks: include full match when invoking plugins

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2024-04-22 13:16:26 +01:00
..
examples/helloworld cli-plugins: helloworld: rename var that collided with import 2024-01-11 22:25:15 +01:00
hooks plugins/templates: break on newlines when printing hooks 2024-04-15 12:59:53 +01:00
manager hooks: include full configured command 2024-04-22 13:16:26 +01:00
plugin command: include default otel error handler for the cli 2024-04-03 12:01:28 -05:00
socket plugin: drop explicit unlink 2024-03-22 10:12:40 -06:00