Update README.md

To avoid confusion, it is better to use `localCmd` instead of `rootCmd`
This commit is contained in:
Go Frendi Gunawan 2019-06-04 11:25:58 +07:00 committed by GitHub
parent 67fc4837d2
commit 41e1fdeb7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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. A flag can also be assigned locally which will only apply to that specific command.
```go ```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 ### Local Flag on Parent Commands