Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#20 from chizhg/empty-args-usage
Browse files Browse the repository at this point in the history
Also print out the usage for the deployer if no args are provided
  • Loading branch information
k8s-ci-robot authored Aug 6, 2020
2 parents ef32b5b + fc3b417 commit 4cc85cc
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pkg/app/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,13 @@ func runE(
allFlags := pflag.NewFlagSet(deployerName, pflag.ContinueOnError)
allFlags.AddFlagSet(kubetest2Flags)
allFlags.AddFlagSet(deployerFlags)
if err := allFlags.Parse(deployerArgs); err != nil {
if err := allFlags.Parse(deployerArgs); err != nil && parseError == nil {
// NOTE: we only retain the first parse error currently, and handle below
if err != nil && parseError == nil {
parseError = err
}
parseError = err
}

// print usage and return if explicitly requested
if opts.HelpRequested() {
// print usage and return if no args are provided, or help is explicitly requested
if len(args) == 0 || opts.HelpRequested() {
cmd.Print(usage.String())
return nil
}
Expand Down

0 comments on commit 4cc85cc

Please sign in to comment.