Skip to content

Commit

Permalink
Add parameter judgment for commands that do not require parameters
Browse files Browse the repository at this point in the history
Signed-off-by: Zhou Hao <[email protected]>

Closes: containers#749
Approved by: rhatdan
  • Loading branch information
Zhou Hao authored and rh-atomic-bot committed Jun 5, 2018
1 parent f90b6c0 commit d3d097b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/buildah/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ var (
)

func containersCmd(c *cli.Context) error {
if len(c.Args()) > 0 {
return errors.New("'buildah containers' does not accept arguments")
}
if err := parse.ValidateFlags(c, containersFlags); err != nil {
return err
}
Expand Down
4 changes: 4 additions & 0 deletions cmd/buildah/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
cniversion "github.com/containernetworking/cni/pkg/version"
ispecs "github.com/opencontainers/image-spec/specs-go"
rspecs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
"github.com/projectatomic/buildah"
"github.com/urfave/cli"
)
Expand All @@ -22,6 +23,9 @@ var (

//Function to get and print info for version command
func versionCmd(c *cli.Context) error {
if len(c.Args()) > 0 {
return errors.New("'buildah version' does not accept arguments")
}

//converting unix time from string to int64
buildTime, err := strconv.ParseInt(buildInfo, 10, 64)
Expand Down

0 comments on commit d3d097b

Please sign in to comment.