Merge pull request #2474 from tonistiigi/runplugin

plugin: make runplugin public
This commit is contained in:
Sebastiaan van Stijn 2020-04-29 13:14:25 +02:00 committed by GitHub
commit 0a5468dba9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -24,7 +24,8 @@ import (
// called. // called.
var PersistentPreRunE func(*cobra.Command, []string) error var PersistentPreRunE func(*cobra.Command, []string) error
func runPlugin(dockerCli *command.DockerCli, plugin *cobra.Command, meta manager.Metadata) error { // RunPlugin executes the specified plugin command
func RunPlugin(dockerCli *command.DockerCli, plugin *cobra.Command, meta manager.Metadata) error {
tcmd := newPluginCommand(dockerCli, plugin, meta) tcmd := newPluginCommand(dockerCli, plugin, meta)
var persistentPreRunOnce sync.Once var persistentPreRunOnce sync.Once
@ -60,7 +61,7 @@ func Run(makeCmd func(command.Cli) *cobra.Command, meta manager.Metadata) {
plugin := makeCmd(dockerCli) plugin := makeCmd(dockerCli)
if err := runPlugin(dockerCli, plugin, meta); err != nil { if err := RunPlugin(dockerCli, plugin, meta); err != nil {
if sterr, ok := err.(cli.StatusError); ok { if sterr, ok := err.(cli.StatusError); ok {
if sterr.Status != "" { if sterr.Status != "" {
fmt.Fprintln(dockerCli.Err(), sterr.Status) fmt.Fprintln(dockerCli.Err(), sterr.Status)