mirror of
https://github.com/spf13/cobra
synced 2025-08-13 05:07:50 +00:00
rename to MatchAll
This commit is contained in:
parent
c02fa6c215
commit
1dabb28da3
2 changed files with 4 additions and 4 deletions
4
args.go
4
args.go
|
@ -108,8 +108,8 @@ func RangeArgs(min int, max int) PositionalArgs {
|
|||
}
|
||||
}
|
||||
|
||||
// ComposedArgs allows combining several PositionalArgs to work in concert.
|
||||
func ComposedArgs(pargs ...PositionalArgs) PositionalArgs {
|
||||
// MatchAll allows combining several PositionalArgs to work in concert.
|
||||
func MatchAll(pargs ...PositionalArgs) PositionalArgs {
|
||||
return func(cmd *Command, args []string) error {
|
||||
for _, parg := range pargs {
|
||||
if err := parg(cmd, args); err != nil {
|
||||
|
|
|
@ -287,10 +287,10 @@ func TestChildTakesArgs(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestComposedArgs(t *testing.T) {
|
||||
func TestMatchAll(t *testing.T) {
|
||||
// Somewhat contrived example check that ensures there are exactly 3
|
||||
// arguments, and each argument is exactly 2 bytes long.
|
||||
pargs := ComposedArgs(
|
||||
pargs := MatchAll(
|
||||
ExactArgs(3),
|
||||
func(cmd *Command, args []string) error {
|
||||
for _, arg := range args {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue