mirror of
https://github.com/spf13/cobra
synced 2025-05-06 05:17:21 +00:00
Update README.md
To avoid confusion, it is better to use `localCmd` instead of `rootCmd`
This commit is contained in:
parent
67fc4837d2
commit
41e1fdeb7a
1 changed files with 1 additions and 1 deletions
|
@ -336,7 +336,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…
Add table
Reference in a new issue