MatchAll allows combining several PositionalArgs to work in concert.
(pargs ...PositionalArgs)
| 112 | |
| 113 | // MatchAll allows combining several PositionalArgs to work in concert. |
| 114 | func MatchAll(pargs ...PositionalArgs) PositionalArgs { |
| 115 | return func(cmd *Command, args []string) error { |
| 116 | for _, parg := range pargs { |
| 117 | if err := parg(cmd, args); err != nil { |
| 118 | return err |
| 119 | } |
| 120 | } |
| 121 | return nil |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | // ExactValidArgs returns an error if there are not exactly N positional args OR |
| 126 | // there are any positional args that are not in the `ValidArgs` field of `Command` |
no outgoing calls