mirror of
https://github.com/spf13/cobra
synced 2024-12-27 14:57:06 +00:00
Update README.md
To avoid confusion, it is better to use `localCmd` instead of `rootCmd`
This commit is contained in:
parent
9eb9f5c66b
commit
5f23f55c81
1 changed files with 1 additions and 1 deletions
|
@ -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 a new issue