mirror of
https://github.com/spf13/cobra
synced 2024-11-24 14:47:12 +00:00
Fixed typo in user guide
This commit is contained in:
parent
0967a36905
commit
6390763171
1 changed files with 4 additions and 4 deletions
|
@ -337,15 +337,15 @@ If your command has multiple required flags that are not [grouped](#flag-groups)
|
|||
when one or more flags have not been set, mark them as required:
|
||||
```go
|
||||
rootCmd.Flags().StringVarP(&Region, "region", "r", "", "AWS region (required)")
|
||||
rootCmd.Flags().StringVarP(&Region, "failoverRegion", "f", "", "AWS failover region (required)")
|
||||
rootCmd.MarkFlagsRequired("region", "failoverRegion")
|
||||
rootCmd.Flags().StringVarP(&Failover, "failover", "f", "", "AWS failover region (required)")
|
||||
rootCmd.MarkFlagsRequired("region", "failover")
|
||||
```
|
||||
|
||||
Or, for multiple persistent flags:
|
||||
```go
|
||||
rootCmd.PersistentFlags().StringVarP(&Region, "region", "r", "", "AWS region (required)")
|
||||
rootCmd.PersistentFlags().StringVarP(&Region, "failoverRegion", "f", "", "AWS failover region (required)")
|
||||
rootCmd.MarkPersistentFlagsRequired("region", "failoverRegion")
|
||||
rootCmd.PersistentFlags().StringVarP(&Failover, "failover", "f", "", "AWS failover region (required)")
|
||||
rootCmd.MarkPersistentFlagsRequired("region", "failover")
|
||||
```
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue