mirror of https://github.com/spf13/cobra.git
Fixed typo in user guide
This commit is contained in:
parent
0967a36905
commit
6390763171
|
@ -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:
|
when one or more flags have not been set, mark them as required:
|
||||||
```go
|
```go
|
||||||
rootCmd.Flags().StringVarP(&Region, "region", "r", "", "AWS region (required)")
|
rootCmd.Flags().StringVarP(&Region, "region", "r", "", "AWS region (required)")
|
||||||
rootCmd.Flags().StringVarP(&Region, "failoverRegion", "f", "", "AWS failover region (required)")
|
rootCmd.Flags().StringVarP(&Failover, "failover", "f", "", "AWS failover region (required)")
|
||||||
rootCmd.MarkFlagsRequired("region", "failoverRegion")
|
rootCmd.MarkFlagsRequired("region", "failover")
|
||||||
```
|
```
|
||||||
|
|
||||||
Or, for multiple persistent flags:
|
Or, for multiple persistent flags:
|
||||||
```go
|
```go
|
||||||
rootCmd.PersistentFlags().StringVarP(&Region, "region", "r", "", "AWS region (required)")
|
rootCmd.PersistentFlags().StringVarP(&Region, "region", "r", "", "AWS region (required)")
|
||||||
rootCmd.PersistentFlags().StringVarP(&Region, "failoverRegion", "f", "", "AWS failover region (required)")
|
rootCmd.PersistentFlags().StringVarP(&Failover, "failover", "f", "", "AWS failover region (required)")
|
||||||
rootCmd.MarkPersistentFlagsRequired("region", "failoverRegion")
|
rootCmd.MarkPersistentFlagsRequired("region", "failover")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue