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 <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2016-09-08 14:54:01 -04:00
parent 3bd1eb4b76
commit 8f3e3fb6e5
17 changed files with 57 additions and 57 deletions

View File

@ -16,7 +16,7 @@ import (
"github.com/spf13/cobra" "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) { func AddCommands(cmd *cobra.Command, dockerCli *command.DockerCli) {
cmd.AddCommand( cmd.AddCommand(
node.NewNodeCommand(dockerCli), node.NewNodeCommand(dockerCli),

View File

@ -5,13 +5,13 @@ package plugin
import ( import (
"fmt" "fmt"
"github.com/docker/docker/api/client"
"github.com/docker/docker/cli" "github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
// NewPluginCommand returns a cobra command for `plugin` subcommands // 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{ cmd := &cobra.Command{
Use: "plugin", Use: "plugin",
Short: "Manage Docker plugins", Short: "Manage Docker plugins",

View File

@ -5,14 +5,14 @@ package plugin
import ( import (
"fmt" "fmt"
"github.com/docker/docker/api/client"
"github.com/docker/docker/cli" "github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/docker/docker/reference" "github.com/docker/docker/reference"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"golang.org/x/net/context" "golang.org/x/net/context"
) )
func newDisableCommand(dockerCli *client.DockerCli) *cobra.Command { func newDisableCommand(dockerCli *command.DockerCli) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "disable PLUGIN", Use: "disable PLUGIN",
Short: "Disable a plugin", Short: "Disable a plugin",
@ -25,7 +25,7 @@ func newDisableCommand(dockerCli *client.DockerCli) *cobra.Command {
return cmd 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 named, err := reference.ParseNamed(name) // FIXME: validate
if err != nil { if err != nil {
return err return err

View File

@ -5,14 +5,14 @@ package plugin
import ( import (
"fmt" "fmt"
"github.com/docker/docker/api/client"
"github.com/docker/docker/cli" "github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/docker/docker/reference" "github.com/docker/docker/reference"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"golang.org/x/net/context" "golang.org/x/net/context"
) )
func newEnableCommand(dockerCli *client.DockerCli) *cobra.Command { func newEnableCommand(dockerCli *command.DockerCli) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "enable PLUGIN", Use: "enable PLUGIN",
Short: "Enable a plugin", Short: "Enable a plugin",
@ -25,7 +25,7 @@ func newEnableCommand(dockerCli *client.DockerCli) *cobra.Command {
return cmd 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 named, err := reference.ParseNamed(name) // FIXME: validate
if err != nil { if err != nil {
return err return err

View File

@ -5,9 +5,9 @@ package plugin
import ( import (
"fmt" "fmt"
"github.com/docker/docker/api/client"
"github.com/docker/docker/api/client/inspect"
"github.com/docker/docker/cli" "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/docker/docker/reference"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"golang.org/x/net/context" "golang.org/x/net/context"
@ -18,7 +18,7 @@ type inspectOptions struct {
format string format string
} }
func newInspectCommand(dockerCli *client.DockerCli) *cobra.Command { func newInspectCommand(dockerCli *command.DockerCli) *cobra.Command {
var opts inspectOptions var opts inspectOptions
cmd := &cobra.Command{ cmd := &cobra.Command{
@ -36,7 +36,7 @@ func newInspectCommand(dockerCli *client.DockerCli) *cobra.Command {
return cmd return cmd
} }
func runInspect(dockerCli *client.DockerCli, opts inspectOptions) error { func runInspect(dockerCli *command.DockerCli, opts inspectOptions) error {
client := dockerCli.Client() client := dockerCli.Client()
ctx := context.Background() ctx := context.Background()
getRef := func(name string) (interface{}, []byte, error) { getRef := func(name string) (interface{}, []byte, error) {

View File

@ -7,9 +7,9 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/docker/docker/api/client"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/cli" "github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/docker/docker/reference" "github.com/docker/docker/reference"
"github.com/docker/docker/registry" "github.com/docker/docker/registry"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -22,7 +22,7 @@ type pluginOptions struct {
disable bool disable bool
} }
func newInstallCommand(dockerCli *client.DockerCli) *cobra.Command { func newInstallCommand(dockerCli *command.DockerCli) *cobra.Command {
var options pluginOptions var options pluginOptions
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "install [OPTIONS] PLUGIN", Use: "install [OPTIONS] PLUGIN",
@ -41,7 +41,7 @@ func newInstallCommand(dockerCli *client.DockerCli) *cobra.Command {
return cmd 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 named, err := reference.ParseNamed(opts.name) // FIXME: validate
if err != nil { if err != nil {
return err return err
@ -63,7 +63,7 @@ func runInstall(dockerCli *client.DockerCli, opts pluginOptions) error {
authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index) authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index)
encodedAuth, err := client.EncodeAuthToBase64(authConfig) encodedAuth, err := command.EncodeAuthToBase64(authConfig)
if err != nil { if err != nil {
return err return err
} }
@ -85,7 +85,7 @@ func runInstall(dockerCli *client.DockerCli, opts pluginOptions) error {
return nil 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) { return func(privileges types.PluginPrivileges) (bool, error) {
fmt.Fprintf(dockerCli.Out(), "Plugin %q is requesting the following privileges:\n", name) fmt.Fprintf(dockerCli.Out(), "Plugin %q is requesting the following privileges:\n", name)
for _, privilege := range privileges { for _, privilege := range privileges {

View File

@ -7,8 +7,8 @@ import (
"strings" "strings"
"text/tabwriter" "text/tabwriter"
"github.com/docker/docker/api/client"
"github.com/docker/docker/cli" "github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/docker/docker/pkg/stringutils" "github.com/docker/docker/pkg/stringutils"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"golang.org/x/net/context" "golang.org/x/net/context"
@ -18,7 +18,7 @@ type listOptions struct {
noTrunc bool noTrunc bool
} }
func newListCommand(dockerCli *client.DockerCli) *cobra.Command { func newListCommand(dockerCli *command.DockerCli) *cobra.Command {
var opts listOptions var opts listOptions
cmd := &cobra.Command{ cmd := &cobra.Command{
@ -38,7 +38,7 @@ func newListCommand(dockerCli *client.DockerCli) *cobra.Command {
return cmd 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()) plugins, err := dockerCli.Client().PluginList(context.Background())
if err != nil { if err != nil {
return err return err

View File

@ -7,14 +7,14 @@ import (
"golang.org/x/net/context" "golang.org/x/net/context"
"github.com/docker/docker/api/client"
"github.com/docker/docker/cli" "github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/docker/docker/reference" "github.com/docker/docker/reference"
"github.com/docker/docker/registry" "github.com/docker/docker/registry"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
func newPushCommand(dockerCli *client.DockerCli) *cobra.Command { func newPushCommand(dockerCli *command.DockerCli) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "push PLUGIN", Use: "push PLUGIN",
Short: "Push a plugin", Short: "Push a plugin",
@ -26,7 +26,7 @@ func newPushCommand(dockerCli *client.DockerCli) *cobra.Command {
return cmd 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 named, err := reference.ParseNamed(name) // FIXME: validate
if err != nil { if err != nil {
return err return err
@ -47,7 +47,7 @@ func runPush(dockerCli *client.DockerCli, name string) error {
} }
authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index) authConfig := dockerCli.ResolveAuthConfig(ctx, repoInfo.Index)
encodedAuth, err := client.EncodeAuthToBase64(authConfig) encodedAuth, err := command.EncodeAuthToBase64(authConfig)
if err != nil { if err != nil {
return err return err
} }

View File

@ -5,9 +5,9 @@ package plugin
import ( import (
"fmt" "fmt"
"github.com/docker/docker/api/client"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/cli" "github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/docker/docker/reference" "github.com/docker/docker/reference"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"golang.org/x/net/context" "golang.org/x/net/context"
@ -19,7 +19,7 @@ type rmOptions struct {
plugins []string plugins []string
} }
func newRemoveCommand(dockerCli *client.DockerCli) *cobra.Command { func newRemoveCommand(dockerCli *command.DockerCli) *cobra.Command {
var opts rmOptions var opts rmOptions
cmd := &cobra.Command{ cmd := &cobra.Command{
@ -38,7 +38,7 @@ func newRemoveCommand(dockerCli *client.DockerCli) *cobra.Command {
return cmd return cmd
} }
func runRemove(dockerCli *client.DockerCli, opts *rmOptions) error { func runRemove(dockerCli *command.DockerCli, opts *rmOptions) error {
ctx := context.Background() ctx := context.Background()
var errs cli.Errors var errs cli.Errors

View File

@ -7,13 +7,13 @@ import (
"golang.org/x/net/context" "golang.org/x/net/context"
"github.com/docker/docker/api/client"
"github.com/docker/docker/cli" "github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/docker/docker/reference" "github.com/docker/docker/reference"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
func newSetCommand(dockerCli *client.DockerCli) *cobra.Command { func newSetCommand(dockerCli *command.DockerCli) *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "set PLUGIN key1=value1 [key2=value2...]", Use: "set PLUGIN key1=value1 [key2=value2...]",
Short: "Change settings for a plugin", Short: "Change settings for a plugin",
@ -26,7 +26,7 @@ func newSetCommand(dockerCli *client.DockerCli) *cobra.Command {
return cmd 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 named, err := reference.ParseNamed(name) // FIXME: validate
if err != nil { if err != nil {
return err return err

View File

@ -5,13 +5,13 @@ package stack
import ( import (
"fmt" "fmt"
"github.com/docker/docker/api/client"
"github.com/docker/docker/cli" "github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
// NewStackCommand returns a cobra command for `stack` subcommands // 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{ cmd := &cobra.Command{
Use: "stack", Use: "stack",
Short: "Manage Docker stacks", Short: "Manage Docker stacks",
@ -31,7 +31,7 @@ func NewStackCommand(dockerCli *client.DockerCli) *cobra.Command {
} }
// NewTopLevelDeployCommand returns a command for `docker deploy` // NewTopLevelDeployCommand returns a command for `docker deploy`
func NewTopLevelDeployCommand(dockerCli *client.DockerCli) *cobra.Command { func NewTopLevelDeployCommand(dockerCli *command.DockerCli) *cobra.Command {
cmd := newDeployCommand(dockerCli) cmd := newDeployCommand(dockerCli)
// Remove the aliases at the top level // Remove the aliases at the top level
cmd.Aliases = []string{} cmd.Aliases = []string{}

View File

@ -3,9 +3,9 @@
package stack package stack
import ( import (
"github.com/docker/docker/api/client"
"github.com/docker/docker/api/client/bundlefile"
"github.com/docker/docker/cli" "github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/docker/docker/cli/command/bundlefile"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -14,7 +14,7 @@ type configOptions struct {
namespace string namespace string
} }
func newConfigCommand(dockerCli *client.DockerCli) *cobra.Command { func newConfigCommand(dockerCli *command.DockerCli) *cobra.Command {
var opts configOptions var opts configOptions
cmd := &cobra.Command{ cmd := &cobra.Command{
@ -32,7 +32,7 @@ func newConfigCommand(dockerCli *client.DockerCli) *cobra.Command {
return cmd 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) bundle, err := loadBundlefile(dockerCli.Err(), opts.namespace, opts.bundlefile)
if err != nil { if err != nil {
return err return err

View File

@ -8,11 +8,11 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"golang.org/x/net/context" "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"
"github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/cli" "github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/docker/docker/cli/command/bundlefile"
) )
const ( const (
@ -25,7 +25,7 @@ type deployOptions struct {
sendRegistryAuth bool sendRegistryAuth bool
} }
func newDeployCommand(dockerCli *client.DockerCli) *cobra.Command { func newDeployCommand(dockerCli *command.DockerCli) *cobra.Command {
var opts deployOptions var opts deployOptions
cmd := &cobra.Command{ cmd := &cobra.Command{
@ -45,7 +45,7 @@ func newDeployCommand(dockerCli *client.DockerCli) *cobra.Command {
return cmd 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) bundle, err := loadBundlefile(dockerCli.Err(), opts.namespace, opts.bundlefile)
if err != nil { if err != nil {
return err return err
@ -85,7 +85,7 @@ func getUniqueNetworkNames(services map[string]bundlefile.Service) []string {
func updateNetworks( func updateNetworks(
ctx context.Context, ctx context.Context,
dockerCli *client.DockerCli, dockerCli *command.DockerCli,
networks []string, networks []string,
namespace string, namespace string,
) error { ) error {
@ -133,7 +133,7 @@ func convertNetworks(networks []string, namespace string, name string) []swarm.N
func deployServices( func deployServices(
ctx context.Context, ctx context.Context,
dockerCli *client.DockerCli, dockerCli *command.DockerCli,
services map[string]bundlefile.Service, services map[string]bundlefile.Service,
namespace string, namespace string,
sendAuth bool, sendAuth bool,

View File

@ -7,7 +7,7 @@ import (
"io" "io"
"os" "os"
"github.com/docker/docker/api/client/bundlefile" "github.com/docker/docker/cli/command/bundlefile"
"github.com/spf13/pflag" "github.com/spf13/pflag"
) )

View File

@ -7,12 +7,12 @@ import (
"golang.org/x/net/context" "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"
"github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/cli" "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/docker/docker/opts"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -25,7 +25,7 @@ type psOptions struct {
noResolve bool noResolve bool
} }
func newPsCommand(dockerCli *client.DockerCli) *cobra.Command { func newPsCommand(dockerCli *command.DockerCli) *cobra.Command {
opts := psOptions{filter: opts.NewFilterOpt()} opts := psOptions{filter: opts.NewFilterOpt()}
cmd := &cobra.Command{ cmd := &cobra.Command{
@ -46,7 +46,7 @@ func newPsCommand(dockerCli *client.DockerCli) *cobra.Command {
return cmd return cmd
} }
func runPS(dockerCli *client.DockerCli, opts psOptions) error { func runPS(dockerCli *command.DockerCli, opts psOptions) error {
namespace := opts.namespace namespace := opts.namespace
client := dockerCli.Client() client := dockerCli.Client()
ctx := context.Background() ctx := context.Background()

View File

@ -7,8 +7,8 @@ import (
"golang.org/x/net/context" "golang.org/x/net/context"
"github.com/docker/docker/api/client"
"github.com/docker/docker/cli" "github.com/docker/docker/cli"
"github.com/docker/docker/cli/command"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -16,7 +16,7 @@ type removeOptions struct {
namespace string namespace string
} }
func newRemoveCommand(dockerCli *client.DockerCli) *cobra.Command { func newRemoveCommand(dockerCli *command.DockerCli) *cobra.Command {
var opts removeOptions var opts removeOptions
cmd := &cobra.Command{ cmd := &cobra.Command{
@ -32,7 +32,7 @@ func newRemoveCommand(dockerCli *client.DockerCli) *cobra.Command {
return cmd return cmd
} }
func runRemove(dockerCli *client.DockerCli, opts removeOptions) error { func runRemove(dockerCli *command.DockerCli, opts removeOptions) error {
namespace := opts.namespace namespace := opts.namespace
client := dockerCli.Client() client := dockerCli.Client()
stderr := dockerCli.Err() stderr := dockerCli.Err()

View File

@ -7,11 +7,11 @@ import (
"golang.org/x/net/context" "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"
"github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/filters"
"github.com/docker/docker/cli" "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/docker/docker/opts"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -26,7 +26,7 @@ type servicesOptions struct {
namespace string namespace string
} }
func newServicesCommand(dockerCli *client.DockerCli) *cobra.Command { func newServicesCommand(dockerCli *command.DockerCli) *cobra.Command {
opts := servicesOptions{filter: opts.NewFilterOpt()} opts := servicesOptions{filter: opts.NewFilterOpt()}
cmd := &cobra.Command{ cmd := &cobra.Command{
@ -45,7 +45,7 @@ func newServicesCommand(dockerCli *client.DockerCli) *cobra.Command {
return cmd return cmd
} }
func runServices(dockerCli *client.DockerCli, opts servicesOptions) error { func runServices(dockerCli *command.DockerCli, opts servicesOptions) error {
ctx := context.Background() ctx := context.Background()
client := dockerCli.Client() client := dockerCli.Client()