MCPcopy
hub / github.com/spf13/cobra / MatchAll

Function MatchAll

args.go:114–123  ·  view source on GitHub ↗

MatchAll allows combining several PositionalArgs to work in concert.

(pargs ...PositionalArgs)

Source from the content-addressed store, hash-verified

112
113// MatchAll allows combining several PositionalArgs to work in concert.
114func 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`

Calls

no outgoing calls