Skip to content

Commit

Permalink
skip validation on non-required missing args
Browse files Browse the repository at this point in the history
  • Loading branch information
unRob committed Nov 22, 2021
1 parent ff753c1 commit c0cfbcc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/arguments.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,12 @@ func (arg *Argument) ToString(asShell bool) string {

func (arg *Argument) Validate(cmd *Command) error {

if arg.Required && !arg.IsKnown() {
return BadArguments{fmt.Sprintf("Missing argument for %s", strings.ToUpper(arg.Name))}
if !arg.IsKnown() {
if arg.Required {
return BadArguments{fmt.Sprintf("Missing argument for %s", strings.ToUpper(arg.Name))}
}

return nil
}

if !arg.Validates() {
Expand Down

0 comments on commit c0cfbcc

Please sign in to comment.