moby/cli/command/plugin/disable.go
Harald Albers aad095f573 Add [OPTIONS] to usage of plugin disable|push
Signed-off-by: Harald Albers <github@albersweb.de>
2017-01-27 16:17:02 +01:00

36 lines
914 B
Go

package plugin
import (
"fmt"
"github.com/docker/docker/api/types"
"github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/spf13/cobra"
"golang.org/x/net/context"
)
func newDisableCommand(dockerCli *command.DockerCli) *cobra.Command {
var force bool
cmd := &cobra.Command{
Use: "disable [OPTIONS] PLUGIN",
Short: "Disable a plugin",
Args: cli.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return runDisable(dockerCli, args[0], force)
},
}
flags := cmd.Flags()
flags.BoolVarP(&force, "force", "f", false, "Force the disable of an active plugin")
return cmd
}
func runDisable(dockerCli *command.DockerCli, name string, force bool) error {
if err := dockerCli.Client().PluginDisable(context.Background(), name, types.PluginDisableOptions{Force: force}); err != nil {
return err
}
fmt.Fprintln(dockerCli.Out(), name)
return nil
}