(cmd Usable, errorMessage string, pred func() bool)
| 14 | } |
| 15 | |
| 16 | func NewUsageRequirement(cmd Usable, errorMessage string, pred func() bool) Requirement { |
| 17 | return RequirementFunction(func() error { |
| 18 | if pred() { |
| 19 | m := fmt.Sprintf("%s. %s\n\n%s", T("Incorrect Usage"), errorMessage, cmd.Usage()) |
| 20 | |
| 21 | return errors.New(m) |
| 22 | } |
| 23 | |
| 24 | return nil |
| 25 | }) |
| 26 | } |
| 27 | |
| 28 | type Usable interface { |
| 29 | Usage() string |
no test coverage detected