Skip to content

Commit 8fbb70a

Browse files
Merge pull request #6475 from thaJeztah/cli_plugin_options
cli-plugins/plugin: Run: allow customizing the CLI
2 parents f3687d8 + 2711800 commit 8fbb70a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cli-plugins/plugin/plugin.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,13 @@ func RunPlugin(dockerCli *command.DockerCli, plugin *cobra.Command, meta metadat
8282

8383
// Run is the top-level entry point to the CLI plugin framework. It should
8484
// be called from the plugin's "main()" function. It initializes a new
85-
// [command.DockerCli] instance before calling makeCmd to construct the
86-
// plugin command, then invokes the plugin command using [RunPlugin].
87-
func Run(makeCmd func(command.Cli) *cobra.Command, meta metadata.Metadata) {
85+
// [command.DockerCli] instance with the given options before calling
86+
// makeCmd to construct the plugin command, then invokes the plugin command
87+
// using [RunPlugin].
88+
func Run(makeCmd func(command.Cli) *cobra.Command, meta metadata.Metadata, ops ...command.CLIOption) {
8889
otel.SetErrorHandler(debug.OTELErrorHandler)
8990

90-
dockerCLI, err := command.NewDockerCli()
91+
dockerCLI, err := command.NewDockerCli(ops...)
9192
if err != nil {
9293
_, _ = fmt.Fprintln(os.Stderr, err)
9394
os.Exit(1)

0 commit comments

Comments
 (0)