Collapse nested if with an &&
This commit is contained in:
parent
d6c8b40201
commit
c48a1423a1
|
@ -363,16 +363,14 @@ func (c *Context) Input(mode InputMode) error {
|
||||||
"Error asking for %s: %s", n, err)
|
"Error asking for %s: %s", n, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if value == "" {
|
if value == "" && v.Required() {
|
||||||
if v.Required() {
|
// Redo if it is required, but abort if we keep getting
|
||||||
// Redo if it is required, but abort if we keep getting
|
// blank entries
|
||||||
// blank entries
|
if retry > 2 {
|
||||||
if retry > 2 {
|
return fmt.Errorf("missing required value for %q", n)
|
||||||
return fmt.Errorf("missing required value for %q", n)
|
|
||||||
}
|
|
||||||
retry++
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
retry++
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue