mirror of
https://github.com/spf13/cobra
synced 2025-05-05 12:57:22 +00:00
adjust docs
This commit is contained in:
parent
6863083cdd
commit
8095ca31dd
2 changed files with 2 additions and 2 deletions
2
args.go
2
args.go
|
@ -111,7 +111,7 @@ func MatchAll(pargs ...PositionalArgs) PositionalArgs {
|
||||||
// ExactValidArgs returns an error if there are not exactly N positional args OR
|
// ExactValidArgs returns an error if there are not exactly N positional args OR
|
||||||
// there are any positional args that are not in the `ValidArgs` field of `Command`
|
// there are any positional args that are not in the `ValidArgs` field of `Command`
|
||||||
//
|
//
|
||||||
// Deprecated: use MatchAll(OnlyValidArgs, ExactArgs(n)) instead
|
// Deprecated: use MatchAll(ExactArgs(n), OnlyValidArgs) instead
|
||||||
func ExactValidArgs(n int) PositionalArgs {
|
func ExactValidArgs(n int) PositionalArgs {
|
||||||
return MatchAll(ExactArgs(n), OnlyValidArgs)
|
return MatchAll(ExactArgs(n), OnlyValidArgs)
|
||||||
}
|
}
|
||||||
|
|
|
@ -349,7 +349,7 @@ shown below:
|
||||||
```go
|
```go
|
||||||
var cmd = &cobra.Command{
|
var cmd = &cobra.Command{
|
||||||
Short: "hello",
|
Short: "hello",
|
||||||
Args: MatchAll(OnlyValidArgs, ExactArgs(2)),
|
Args: MatchAll(ExactArgs(2), OnlyValidArgs),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
fmt.Println("Hello, World!")
|
fmt.Println("Hello, World!")
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue