From 9c2b9358125175db366ca000e6dae9af8dc88e2d Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Thu, 8 Sep 2016 14:54:01 -0400 Subject: [PATCH] Replace api/client imports with cli/command in experimental files. Using git grep -l 'client\.DockerCli' cli/command/stack/ | xargs sed -i -e 's/client\.DockerCli/command\.Dockercli/g' Signed-off-by: Daniel Nephin --- cli/command/commands/commands.go | 2 +- cli/command/plugin/cmd_experimental.go | 4 ++-- cli/command/plugin/disable.go | 6 +++--- cli/command/plugin/enable.go | 6 +++--- cli/command/plugin/inspect.go | 8 ++++---- cli/command/plugin/install.go | 10 +++++----- cli/command/plugin/list.go | 6 +++--- cli/command/plugin/push.go | 8 ++++---- cli/command/plugin/remove.go | 6 +++--- cli/command/plugin/set.go | 6 +++--- cli/command/stack/cmd.go | 6 +++--- cli/command/stack/config.go | 8 ++++---- cli/command/stack/deploy.go | 12 ++++++------ cli/command/stack/opts.go | 2 +- cli/command/stack/ps.go | 10 +++++----- cli/command/stack/remove.go | 6 +++--- cli/command/stack/services.go | 8 ++++---- pkg/signal/signal_unix.go | 2 +- pkg/signal/signal_windows.go | 2 +- 19 files changed, 59 insertions(+), 59 deletions(-) diff --git a/cli/command/commands/commands.go b/cli/command/commands/commands.go index 3eb1828d57..35fd6860b0 100644 --- a/cli/command/commands/commands.go +++ b/cli/command/commands/commands.go @@ -16,7 +16,7 @@ import ( "github.com/spf13/cobra" ) -// AddCommands adds all the commands from api/client to the root command +// AddCommands adds all the commands from cli/command to the root command func AddCommands(cmd *cobra.Command, dockerCli *command.DockerCli) { cmd.AddCommand( node.NewNodeCommand(dockerCli), diff --git a/cli/command/plugin/cmd_experimental.go b/cli/command/plugin/cmd_experimental.go index 6c991937fe..cc779143fa 100644 --- a/cli/command/plugin/cmd_experimental.go +++ b/cli/command/plugin/cmd_experimental.go @@ -5,13 +5,13 @@ package plugin import ( "fmt" - "github.com/docker/docker/api/client" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" "github.com/spf13/cobra" ) // NewPluginCommand returns a cobra command for `plugin` subcommands -func NewPluginCommand(rootCmd *cobra.Command, dockerCli *client.DockerCli) { +func NewPluginCommand(rootCmd *cobra.Command, dockerCli *command.DockerCli) { cmd := &cobra.Command{ Use: "plugin", Short: "Manage Docker plugins", diff --git a/cli/command/plugin/disable.go b/cli/command/plugin/disable.go index 704eb75286..3b5c69a018 100644 --- a/cli/command/plugin/disable.go +++ b/cli/command/plugin/disable.go @@ -5,14 +5,14 @@ package plugin import ( "fmt" - "github.com/docker/docker/api/client" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" "github.com/docker/docker/reference" "github.com/spf13/cobra" "golang.org/x/net/context" ) -func newDisableCommand(dockerCli *client.DockerCli) *cobra.Command { +func newDisableCommand(dockerCli *command.DockerCli) *cobra.Command { cmd := &cobra.Command{ Use: "disable PLUGIN", Short: "Disable a plugin", @@ -25,7 +25,7 @@ func newDisableCommand(dockerCli *client.DockerCli) *cobra.Command { return cmd } -func runDisable(dockerCli *client.DockerCli, name string) error { +func runDisable(dockerCli *command.DockerCli, name string) error { named, err := reference.ParseNamed(name) // FIXME: validate if err != nil { return err diff --git a/cli/command/plugin/enable.go b/cli/command/plugin/enable.go index c31258bbb6..cfc3580f43 100644 --- a/cli/command/plugin/enable.go +++ b/cli/command/plugin/enable.go @@ -5,14 +5,14 @@ package plugin import ( "fmt" - "github.com/docker/docker/api/client" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" "github.com/docker/docker/reference" "github.com/spf13/cobra" "golang.org/x/net/context" ) -func newEnableCommand(dockerCli *client.DockerCli) *cobra.Command { +func newEnableCommand(dockerCli *command.DockerCli) *cobra.Command { cmd := &cobra.Command{ Use: "enable PLUGIN", Short: "Enable a plugin", @@ -25,7 +25,7 @@ func newEnableCommand(dockerCli *client.DockerCli) *cobra.Command { return cmd } -func runEnable(dockerCli *client.DockerCli, name string) error { +func runEnable(dockerCli *command.DockerCli, name string) error { named, err := reference.ParseNamed(name) // FIXME: validate if err != nil { return err diff --git a/cli/command/plugin/inspect.go b/cli/command/plugin/inspect.go index b43e3e9453..a1cf1f7b0e 100644 --- a/cli/command/plugin/inspect.go +++ b/cli/command/plugin/inspect.go @@ -5,9 +5,9 @@ package plugin import ( "fmt" - "github.com/docker/docker/api/client" - "github.com/docker/docker/api/client/inspect" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" + "github.com/docker/docker/cli/command/inspect" "github.com/docker/docker/reference" "github.com/spf13/cobra" "golang.org/x/net/context" @@ -18,7 +18,7 @@ type inspectOptions struct { format string } -func newInspectCommand(dockerCli *client.DockerCli) *cobra.Command { +func newInspectCommand(dockerCli *command.DockerCli) *cobra.Command { var opts inspectOptions cmd := &cobra.Command{ @@ -36,7 +36,7 @@ func newInspectCommand(dockerCli *client.DockerCli) *cobra.Command { return cmd } -func runInspect(dockerCli *client.DockerCli, opts inspectOptions) error { +func runInspect(dockerCli *command.DockerCli, opts inspectOptions) error { client := dockerCli.Client() ctx := context.Background() getRef := func(name string) (interface{}, []byte, error) { diff --git a/cli/command/plugin/install.go b/cli/command/plugin/install.go index 05dc8e8268..2867247a84 100644 --- a/cli/command/plugin/install.go +++ b/cli/command/plugin/install.go @@ -7,9 +7,9 @@ import ( "fmt" "strings" - "github.com/docker/docker/api/client" "github.com/docker/docker/api/types" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" "github.com/docker/docker/reference" "github.com/docker/docker/registry" "github.com/spf13/cobra" @@ -22,7 +22,7 @@ type pluginOptions struct { disable bool } -func newInstallCommand(dockerCli *client.DockerCli) *cobra.Command { +func newInstallCommand(dockerCli *command.DockerCli) *cobra.Command { var options pluginOptions cmd := &cobra.Command{ Use: "install [OPTIONS] PLUGIN", @@ -41,7 +41,7 @@ func newInstallCommand(dockerCli *client.DockerCli) *cobra.Command { return cmd } -func runInstall(dockerCli *client.DockerCli, opts pluginOptions) error { +func runInstall(dockerCli *command.DockerCli, opts pluginOptions) error { named, err := reference.ParseNamed(opts.name) // FIXME: validate if err != nil { return err @@ -63,7 +63,7 @@ func runInstall(dockerCli *client.DockerCli, opts pluginOptions) error { authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index) - encodedAuth, err := client.EncodeAuthToBase64(authConfig) + encodedAuth, err := command.EncodeAuthToBase64(authConfig) if err != nil { return err } @@ -85,7 +85,7 @@ func runInstall(dockerCli *client.DockerCli, opts pluginOptions) error { return nil } -func acceptPrivileges(dockerCli *client.DockerCli, name string) func(privileges types.PluginPrivileges) (bool, error) { +func acceptPrivileges(dockerCli *command.DockerCli, name string) func(privileges types.PluginPrivileges) (bool, error) { return func(privileges types.PluginPrivileges) (bool, error) { fmt.Fprintf(dockerCli.Out(), "Plugin %q is requesting the following privileges:\n", name) for _, privilege := range privileges { diff --git a/cli/command/plugin/list.go b/cli/command/plugin/list.go index b50b2066a7..b8f5e5e08a 100644 --- a/cli/command/plugin/list.go +++ b/cli/command/plugin/list.go @@ -7,8 +7,8 @@ import ( "strings" "text/tabwriter" - "github.com/docker/docker/api/client" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" "github.com/docker/docker/pkg/stringutils" "github.com/spf13/cobra" "golang.org/x/net/context" @@ -18,7 +18,7 @@ type listOptions struct { noTrunc bool } -func newListCommand(dockerCli *client.DockerCli) *cobra.Command { +func newListCommand(dockerCli *command.DockerCli) *cobra.Command { var opts listOptions cmd := &cobra.Command{ @@ -38,7 +38,7 @@ func newListCommand(dockerCli *client.DockerCli) *cobra.Command { return cmd } -func runList(dockerCli *client.DockerCli, opts listOptions) error { +func runList(dockerCli *command.DockerCli, opts listOptions) error { plugins, err := dockerCli.Client().PluginList(context.Background()) if err != nil { return err diff --git a/cli/command/plugin/push.go b/cli/command/plugin/push.go index 9ef4907961..5174828ea8 100644 --- a/cli/command/plugin/push.go +++ b/cli/command/plugin/push.go @@ -7,14 +7,14 @@ import ( "golang.org/x/net/context" - "github.com/docker/docker/api/client" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" "github.com/docker/docker/reference" "github.com/docker/docker/registry" "github.com/spf13/cobra" ) -func newPushCommand(dockerCli *client.DockerCli) *cobra.Command { +func newPushCommand(dockerCli *command.DockerCli) *cobra.Command { cmd := &cobra.Command{ Use: "push PLUGIN", Short: "Push a plugin", @@ -26,7 +26,7 @@ func newPushCommand(dockerCli *client.DockerCli) *cobra.Command { return cmd } -func runPush(dockerCli *client.DockerCli, name string) error { +func runPush(dockerCli *command.DockerCli, name string) error { named, err := reference.ParseNamed(name) // FIXME: validate if err != nil { return err @@ -47,7 +47,7 @@ func runPush(dockerCli *client.DockerCli, name string) error { } authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index) - encodedAuth, err := client.EncodeAuthToBase64(authConfig) + encodedAuth, err := command.EncodeAuthToBase64(authConfig) if err != nil { return err } diff --git a/cli/command/plugin/remove.go b/cli/command/plugin/remove.go index 3b61374009..800fc1b97f 100644 --- a/cli/command/plugin/remove.go +++ b/cli/command/plugin/remove.go @@ -5,9 +5,9 @@ package plugin import ( "fmt" - "github.com/docker/docker/api/client" "github.com/docker/docker/api/types" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" "github.com/docker/docker/reference" "github.com/spf13/cobra" "golang.org/x/net/context" @@ -19,7 +19,7 @@ type rmOptions struct { plugins []string } -func newRemoveCommand(dockerCli *client.DockerCli) *cobra.Command { +func newRemoveCommand(dockerCli *command.DockerCli) *cobra.Command { var opts rmOptions cmd := &cobra.Command{ @@ -38,7 +38,7 @@ func newRemoveCommand(dockerCli *client.DockerCli) *cobra.Command { return cmd } -func runRemove(dockerCli *client.DockerCli, opts *rmOptions) error { +func runRemove(dockerCli *command.DockerCli, opts *rmOptions) error { ctx := context.Background() var errs cli.Errors diff --git a/cli/command/plugin/set.go b/cli/command/plugin/set.go index 188bd63cc4..f2d3b082c6 100644 --- a/cli/command/plugin/set.go +++ b/cli/command/plugin/set.go @@ -7,13 +7,13 @@ import ( "golang.org/x/net/context" - "github.com/docker/docker/api/client" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" "github.com/docker/docker/reference" "github.com/spf13/cobra" ) -func newSetCommand(dockerCli *client.DockerCli) *cobra.Command { +func newSetCommand(dockerCli *command.DockerCli) *cobra.Command { cmd := &cobra.Command{ Use: "set PLUGIN key1=value1 [key2=value2...]", Short: "Change settings for a plugin", @@ -26,7 +26,7 @@ func newSetCommand(dockerCli *client.DockerCli) *cobra.Command { return cmd } -func runSet(dockerCli *client.DockerCli, name string, args []string) error { +func runSet(dockerCli *command.DockerCli, name string, args []string) error { named, err := reference.ParseNamed(name) // FIXME: validate if err != nil { return err diff --git a/cli/command/stack/cmd.go b/cli/command/stack/cmd.go index 979e1a0b77..d459e0a9a1 100644 --- a/cli/command/stack/cmd.go +++ b/cli/command/stack/cmd.go @@ -5,13 +5,13 @@ package stack import ( "fmt" - "github.com/docker/docker/api/client" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" "github.com/spf13/cobra" ) // NewStackCommand returns a cobra command for `stack` subcommands -func NewStackCommand(dockerCli *client.DockerCli) *cobra.Command { +func NewStackCommand(dockerCli *command.DockerCli) *cobra.Command { cmd := &cobra.Command{ Use: "stack", Short: "Manage Docker stacks", @@ -31,7 +31,7 @@ func NewStackCommand(dockerCli *client.DockerCli) *cobra.Command { } // NewTopLevelDeployCommand returns a command for `docker deploy` -func NewTopLevelDeployCommand(dockerCli *client.DockerCli) *cobra.Command { +func NewTopLevelDeployCommand(dockerCli *command.DockerCli) *cobra.Command { cmd := newDeployCommand(dockerCli) // Remove the aliases at the top level cmd.Aliases = []string{} diff --git a/cli/command/stack/config.go b/cli/command/stack/config.go index 696c0c3fc7..bdcf7d4835 100644 --- a/cli/command/stack/config.go +++ b/cli/command/stack/config.go @@ -3,9 +3,9 @@ package stack import ( - "github.com/docker/docker/api/client" - "github.com/docker/docker/api/client/bundlefile" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" + "github.com/docker/docker/cli/command/bundlefile" "github.com/spf13/cobra" ) @@ -14,7 +14,7 @@ type configOptions struct { namespace string } -func newConfigCommand(dockerCli *client.DockerCli) *cobra.Command { +func newConfigCommand(dockerCli *command.DockerCli) *cobra.Command { var opts configOptions cmd := &cobra.Command{ @@ -32,7 +32,7 @@ func newConfigCommand(dockerCli *client.DockerCli) *cobra.Command { return cmd } -func runConfig(dockerCli *client.DockerCli, opts configOptions) error { +func runConfig(dockerCli *command.DockerCli, opts configOptions) error { bundle, err := loadBundlefile(dockerCli.Err(), opts.namespace, opts.bundlefile) if err != nil { return err diff --git a/cli/command/stack/deploy.go b/cli/command/stack/deploy.go index 5c03dc3d31..d72c2bd08f 100644 --- a/cli/command/stack/deploy.go +++ b/cli/command/stack/deploy.go @@ -8,11 +8,11 @@ import ( "github.com/spf13/cobra" "golang.org/x/net/context" - "github.com/docker/docker/api/client" - "github.com/docker/docker/api/client/bundlefile" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" + "github.com/docker/docker/cli/command/bundlefile" ) const ( @@ -25,7 +25,7 @@ type deployOptions struct { sendRegistryAuth bool } -func newDeployCommand(dockerCli *client.DockerCli) *cobra.Command { +func newDeployCommand(dockerCli *command.DockerCli) *cobra.Command { var opts deployOptions cmd := &cobra.Command{ @@ -45,7 +45,7 @@ func newDeployCommand(dockerCli *client.DockerCli) *cobra.Command { return cmd } -func runDeploy(dockerCli *client.DockerCli, opts deployOptions) error { +func runDeploy(dockerCli *command.DockerCli, opts deployOptions) error { bundle, err := loadBundlefile(dockerCli.Err(), opts.namespace, opts.bundlefile) if err != nil { return err @@ -85,7 +85,7 @@ func getUniqueNetworkNames(services map[string]bundlefile.Service) []string { func updateNetworks( ctx context.Context, - dockerCli *client.DockerCli, + dockerCli *command.DockerCli, networks []string, namespace string, ) error { @@ -133,7 +133,7 @@ func convertNetworks(networks []string, namespace string, name string) []swarm.N func deployServices( ctx context.Context, - dockerCli *client.DockerCli, + dockerCli *command.DockerCli, services map[string]bundlefile.Service, namespace string, sendAuth bool, diff --git a/cli/command/stack/opts.go b/cli/command/stack/opts.go index 345bdc38f5..eef4d0e45b 100644 --- a/cli/command/stack/opts.go +++ b/cli/command/stack/opts.go @@ -7,7 +7,7 @@ import ( "io" "os" - "github.com/docker/docker/api/client/bundlefile" + "github.com/docker/docker/cli/command/bundlefile" "github.com/spf13/pflag" ) diff --git a/cli/command/stack/ps.go b/cli/command/stack/ps.go index 9d9458d85f..c4683b68a0 100644 --- a/cli/command/stack/ps.go +++ b/cli/command/stack/ps.go @@ -7,12 +7,12 @@ import ( "golang.org/x/net/context" - "github.com/docker/docker/api/client" - "github.com/docker/docker/api/client/idresolver" - "github.com/docker/docker/api/client/task" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" + "github.com/docker/docker/cli/command/idresolver" + "github.com/docker/docker/cli/command/task" "github.com/docker/docker/opts" "github.com/spf13/cobra" ) @@ -25,7 +25,7 @@ type psOptions struct { noResolve bool } -func newPsCommand(dockerCli *client.DockerCli) *cobra.Command { +func newPsCommand(dockerCli *command.DockerCli) *cobra.Command { opts := psOptions{filter: opts.NewFilterOpt()} cmd := &cobra.Command{ @@ -46,7 +46,7 @@ func newPsCommand(dockerCli *client.DockerCli) *cobra.Command { return cmd } -func runPS(dockerCli *client.DockerCli, opts psOptions) error { +func runPS(dockerCli *command.DockerCli, opts psOptions) error { namespace := opts.namespace client := dockerCli.Client() ctx := context.Background() diff --git a/cli/command/stack/remove.go b/cli/command/stack/remove.go index 9ba91e5c23..6ab005d71d 100644 --- a/cli/command/stack/remove.go +++ b/cli/command/stack/remove.go @@ -7,8 +7,8 @@ import ( "golang.org/x/net/context" - "github.com/docker/docker/api/client" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" "github.com/spf13/cobra" ) @@ -16,7 +16,7 @@ type removeOptions struct { namespace string } -func newRemoveCommand(dockerCli *client.DockerCli) *cobra.Command { +func newRemoveCommand(dockerCli *command.DockerCli) *cobra.Command { var opts removeOptions cmd := &cobra.Command{ @@ -32,7 +32,7 @@ func newRemoveCommand(dockerCli *client.DockerCli) *cobra.Command { return cmd } -func runRemove(dockerCli *client.DockerCli, opts removeOptions) error { +func runRemove(dockerCli *command.DockerCli, opts removeOptions) error { namespace := opts.namespace client := dockerCli.Client() stderr := dockerCli.Err() diff --git a/cli/command/stack/services.go b/cli/command/stack/services.go index 819b1c6759..22906378d6 100644 --- a/cli/command/stack/services.go +++ b/cli/command/stack/services.go @@ -7,11 +7,11 @@ import ( "golang.org/x/net/context" - "github.com/docker/docker/api/client" - "github.com/docker/docker/api/client/service" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/cli" + "github.com/docker/docker/cli/command" + "github.com/docker/docker/cli/command/service" "github.com/docker/docker/opts" "github.com/spf13/cobra" ) @@ -26,7 +26,7 @@ type servicesOptions struct { namespace string } -func newServicesCommand(dockerCli *client.DockerCli) *cobra.Command { +func newServicesCommand(dockerCli *command.DockerCli) *cobra.Command { opts := servicesOptions{filter: opts.NewFilterOpt()} cmd := &cobra.Command{ @@ -45,7 +45,7 @@ func newServicesCommand(dockerCli *client.DockerCli) *cobra.Command { return cmd } -func runServices(dockerCli *client.DockerCli, opts servicesOptions) error { +func runServices(dockerCli *command.DockerCli, opts servicesOptions) error { ctx := context.Background() client := dockerCli.Client() diff --git a/pkg/signal/signal_unix.go b/pkg/signal/signal_unix.go index 6621d37184..5d058fd56b 100644 --- a/pkg/signal/signal_unix.go +++ b/pkg/signal/signal_unix.go @@ -6,7 +6,7 @@ import ( "syscall" ) -// Signals used in api/client (no windows equivalent, use +// Signals used in cli/command (no windows equivalent, use // invalid signals so they don't get handled) const ( diff --git a/pkg/signal/signal_windows.go b/pkg/signal/signal_windows.go index 698cbf2dc8..440f2700e2 100644 --- a/pkg/signal/signal_windows.go +++ b/pkg/signal/signal_windows.go @@ -6,7 +6,7 @@ import ( "syscall" ) -// Signals used in api/client (no windows equivalent, use +// Signals used in cli/command (no windows equivalent, use // invalid signals so they don't get handled) const ( SIGCHLD = syscall.Signal(0xff)