Skip to content

Commit

Permalink
fix: be more helpful on bad args (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeldeib committed Apr 21, 2020
1 parent 106bcff commit 7ccff33
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ func newRootCmd() *cobra.Command {
if len(args) < 1 || len(args) > 2 {
return fmt.Errorf("accepts 1 or 2 args, received %d", len(args))
}
if args[0] == "" {
return fmt.Errorf("oldCommit should not be empty")
}
if len(args) == 2 && args[1] == "" {
return fmt.Errorf("if provided, newCommit should not be empty")
}
return nil
}

Expand Down

0 comments on commit 7ccff33

Please sign in to comment.