Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crictl-exec: fix argument parsing #306

Merged
merged 2 commits into from
May 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cmd/crictl/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ import (
)

var runtimeAttachCommand = cli.Command{
Name: "attach",
Usage: "Attach to a running container",
ArgsUsage: "CONTAINER",
Name: "attach",
Usage: "Attach to a running container",
ArgsUsage: "CONTAINER",
SkipArgReorder: true,
UseShortOptionHandling: true,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "tty,t",
Expand Down
8 changes: 5 additions & 3 deletions cmd/crictl/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ func writeConfig(c *Config, filepath string) error {
}

var configCommand = cli.Command{
Name: "config",
Usage: "Get and set crictl options",
ArgsUsage: "[<options>]",
Name: "config",
Usage: "Get and set crictl options",
ArgsUsage: "[<options>]",
SkipArgReorder: true,
UseShortOptionHandling: true,
Flags: []cli.Flag{
cli.StringFlag{
Name: "get",
Expand Down
15 changes: 10 additions & 5 deletions cmd/crictl/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ var createContainerCommand = cli.Command{
Usage: "Create a new container",
ArgsUsage: "POD container-config.[json|yaml] pod-config.[json|yaml]",
Flags: []cli.Flag{},

Action: func(context *cli.Context) error {
if len(context.Args()) != 3 {
return cli.ShowSubcommandHelp(context)
Expand Down Expand Up @@ -160,9 +161,11 @@ var updateContainerCommand = cli.Command{
}

var stopContainerCommand = cli.Command{
Name: "stop",
Usage: "Stop one or more running containers",
ArgsUsage: "CONTAINER [CONTAINER...]",
Name: "stop",
Usage: "Stop one or more running containers",
ArgsUsage: "CONTAINER [CONTAINER...]",
SkipArgReorder: true,
UseShortOptionHandling: true,
Flags: []cli.Flag{
cli.Int64Flag{
Name: "timeout, t",
Expand Down Expand Up @@ -246,8 +249,10 @@ var containerStatusCommand = cli.Command{
}

var listContainersCommand = cli.Command{
Name: "ps",
Usage: "List containers",
Name: "ps",
Usage: "List containers",
SkipArgReorder: true,
UseShortOptionHandling: true,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "verbose, v",
Expand Down
8 changes: 5 additions & 3 deletions cmd/crictl/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ const (
)

var runtimeExecCommand = cli.Command{
Name: "exec",
Usage: "Run a command in a running container",
ArgsUsage: "CONTAINER COMMAND [ARG...]",
Name: "exec",
Usage: "Run a command in a running container",
ArgsUsage: "CONTAINER COMMAND [ARG...]",
SkipArgReorder: true,
UseShortOptionHandling: true,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "sync, s",
Expand Down
22 changes: 14 additions & 8 deletions cmd/crictl/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ func (a imageByRef) Less(i, j int) bool {
}

var pullImageCommand = cli.Command{
Name: "pull",
Usage: "Pull an image from a registry",
Name: "pull",
Usage: "Pull an image from a registry",
SkipArgReorder: true,
UseShortOptionHandling: true,
Flags: []cli.Flag{
cli.StringFlag{
Name: "creds",
Expand Down Expand Up @@ -85,9 +87,11 @@ var pullImageCommand = cli.Command{
}

var listImageCommand = cli.Command{
Name: "images",
Usage: "List images",
ArgsUsage: "[REPOSITORY[:TAG]]",
Name: "images",
Usage: "List images",
ArgsUsage: "[REPOSITORY[:TAG]]",
SkipArgReorder: true,
UseShortOptionHandling: true,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "verbose, v",
Expand Down Expand Up @@ -189,9 +193,11 @@ var listImageCommand = cli.Command{
}

var imageStatusCommand = cli.Command{
Name: "inspecti",
Usage: "Return the status of one ore more images",
ArgsUsage: "IMAGEID [IMAGEID...]",
Name: "inspecti",
Usage: "Return the status of one ore more images",
ArgsUsage: "IMAGEID [IMAGEID...]",
SkipArgReorder: true,
UseShortOptionHandling: true,
Flags: []cli.Flag{
cli.StringFlag{
Name: "output, o",
Expand Down
8 changes: 5 additions & 3 deletions cmd/crictl/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ import (
)

var runtimeStatusCommand = cli.Command{
Name: "info",
Usage: "Display information of the container runtime",
ArgsUsage: "",
Name: "info",
Usage: "Display information of the container runtime",
ArgsUsage: "",
SkipArgReorder: true,
UseShortOptionHandling: true,
Flags: []cli.Flag{
cli.StringFlag{
Name: "output, o",
Expand Down
8 changes: 5 additions & 3 deletions cmd/crictl/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ import (
)

var logsCommand = cli.Command{
Name: "logs",
Usage: "Fetch the logs of a container",
ArgsUsage: "CONTAINER",
Name: "logs",
Usage: "Fetch the logs of a container",
ArgsUsage: "CONTAINER",
SkipArgReorder: true,
UseShortOptionHandling: true,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "follow, f",
Expand Down
14 changes: 9 additions & 5 deletions cmd/crictl/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ var removePodCommand = cli.Command{
}

var podStatusCommand = cli.Command{
Name: "inspectp",
Usage: "Display the status of one or more pods",
ArgsUsage: "POD [POD...]",
Name: "inspectp",
Usage: "Display the status of one or more pods",
ArgsUsage: "POD [POD...]",
SkipArgReorder: true,
UseShortOptionHandling: true,
Flags: []cli.Flag{
cli.StringFlag{
Name: "output, o",
Expand Down Expand Up @@ -148,8 +150,10 @@ var podStatusCommand = cli.Command{
}

var listPodCommand = cli.Command{
Name: "pods",
Usage: "List pods",
Name: "pods",
Usage: "List pods",
SkipArgReorder: true,
UseShortOptionHandling: true,
Flags: []cli.Flag{
cli.StringFlag{
Name: "id",
Expand Down
4 changes: 3 additions & 1 deletion cmd/crictl/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ type statsOptions struct {
var statsCommand = cli.Command{
Name: "stats",
// TODO(random-liu): Support live monitoring of resource usage.
Usage: "List container(s) resource usage statistics",
Usage: "List container(s) resource usage statistics",
SkipArgReorder: true,
UseShortOptionHandling: true,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "all, a",
Expand Down
2 changes: 1 addition & 1 deletion vendor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ github.com/opencontainers/selinux b29023b86e4a69d1b46b7e7b4e2b6fda03f0b9cd
github.com/pborman/uuid ca53cad383cad2479bbba7f7a1a05797ec1386e4
github.com/sirupsen/logrus v1.0.0
github.com/spf13/pflag 9ff6c6923cfffbcd502984b8e0c80539a94968b7
github.com/urfave/cli 7fb9c86b14e6a702a4157ccb5a863f07d844a207
github.com/urfave/cli 8e01ec4cd3e2d84ab2fe90d8210528ffbb06d8ff
golang.org/x/crypto 81e90905daefcd6fd217b62423c0908922eadb30
golang.org/x/net 1c05540f6879653db88113bc4a2b70aec4bd491f
golang.org/x/sys 7ddbeae9ae08c6a06a59597f0c9edbc5ff2444ce
Expand Down
Loading