github.com/kunnos/engine@v1.13.1/cli/command/plugin/inspect.go (about) 1 package plugin 2 3 import ( 4 "github.com/docker/docker/cli" 5 "github.com/docker/docker/cli/command" 6 "github.com/docker/docker/cli/command/inspect" 7 "github.com/spf13/cobra" 8 "golang.org/x/net/context" 9 ) 10 11 type inspectOptions struct { 12 pluginNames []string 13 format string 14 } 15 16 func newInspectCommand(dockerCli *command.DockerCli) *cobra.Command { 17 var opts inspectOptions 18 19 cmd := &cobra.Command{ 20 Use: "inspect [OPTIONS] PLUGIN [PLUGIN...]", 21 Short: "Display detailed information on one or more plugins", 22 Args: cli.RequiresMinArgs(1), 23 RunE: func(cmd *cobra.Command, args []string) error { 24 opts.pluginNames = args 25 return runInspect(dockerCli, opts) 26 }, 27 } 28 29 flags := cmd.Flags() 30 flags.StringVarP(&opts.format, "format", "f", "", "Format the output using the given Go template") 31 return cmd 32 } 33 34 func runInspect(dockerCli *command.DockerCli, opts inspectOptions) error { 35 client := dockerCli.Client() 36 ctx := context.Background() 37 getRef := func(ref string) (interface{}, []byte, error) { 38 return client.PluginInspectWithRaw(ctx, ref) 39 } 40 41 return inspect.Inspect(dockerCli.Out(), opts.pluginNames, opts.format, getRef) 42 }