mirror of https://github.com/spf13/cobra.git
Update README.md
To avoid confusion, it is better to use `localCmd` instead of `rootCmd`
This commit is contained in:
parent
9eb9f5c66b
commit
5f23f55c81
|
@ -338,7 +338,7 @@ rootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose out
|
|||
A flag can also be assigned locally which will only apply to that specific command.
|
||||
|
||||
```go
|
||||
rootCmd.Flags().StringVarP(&Source, "source", "s", "", "Source directory to read from")
|
||||
localCmd.Flags().StringVarP(&Source, "source", "s", "", "Source directory to read from")
|
||||
```
|
||||
|
||||
### Local Flag on Parent Commands
|
||||
|
|
Loading…
Reference in New Issue