Files
docker-cli/components/engine/api/client/volume/cmd.go
Daniel Nephin 041d2192d1 Update usage and help to (almost) match the existing docker behaviour
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 667dcb0e8e550d1a80ee67c6d71979e8cfabea1f
Component: engine
2016-05-31 14:41:37 -07:00

34 lines
766 B
Go

package volume
import (
"fmt"
"github.com/spf13/cobra"
"github.com/docker/docker/api/client"
"github.com/docker/docker/cli"
)
// NewVolumeCommand returns a cobra command for `volume` subcommands
func NewVolumeCommand(dockerCli *client.DockerCli) *cobra.Command {
cmd := &cobra.Command{
Use: "volume",
Short: "Manage Docker volumes",
// TODO: remove once cobra is patched to handle this
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Fprintf(dockerCli.Err(), "\n%s", cmd.UsageString())
if len(args) > 0 {
return cli.StatusError{StatusCode: 1}
}
return nil
},
}
cmd.AddCommand(
newCreateCommand(dockerCli),
newInspectCommand(dockerCli),
newListCommand(dockerCli),
newRemoveCommand(dockerCli),
)
return cmd
}