Files
docker-cli/components/engine/api/client/plugin/inspect.go
Tibor Vass eeb8ef5ac1 plugins: fix usage for plugin commands
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 65ed9daf70ccf0027f4eac8049667130deb249ed
Component: engine
2016-06-17 10:03:30 -07:00

40 lines
789 B
Go

// +build experimental
package plugin
import (
"encoding/json"
"github.com/docker/docker/api/client"
"github.com/docker/docker/cli"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)
func newInspectCommand(dockerCli *client.DockerCli) *cobra.Command {
cmd := &cobra.Command{
Use: "inspect PLUGIN",
Short: "Inspect a plugin",
Args: cli.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return runInspect(dockerCli, args[0])
},
}
return cmd
}
func runInspect(dockerCli *client.DockerCli, name string) error {
p, err := dockerCli.Client().PluginInspect(context.Background(), name)
if err != nil {
return err
}
b, err := json.MarshalIndent(p, "", "\t")
if err != nil {
return err
}
_, err = dockerCli.Out().Write(b)
return err
}