Skip to content

Commit

Permalink
Merge pull request helm#27 from flowjo-shaunr/print-help-on-no-args
Browse files Browse the repository at this point in the history
Print help when no arguments are passed
  • Loading branch information
hickeyma authored Jun 4, 2020
2 parents 12fce7c + d4ba921 commit 6f4d7d7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/mapkubeapis/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ func newMapCmd(out io.Writer, args []string) *cobra.Command {
Long: "Map release deprecated or removed Kubernetes APIs in-place",
SilenceUsage: true,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return errors.New("name of release to be mapped needs to be passed")
if len(args) == 0 {
cmd.Help()
os.Exit(1)
} else if len(args) > 1 {
return errors.New("only one release name may be passed at a time")
}
return nil
},
Expand Down

0 comments on commit 6f4d7d7

Please sign in to comment.