Add example for making persistent flags required (#1135)
This commit is contained in:
		@ -419,6 +419,12 @@ rootCmd.Flags().StringVarP(&Region, "region", "r", "", "AWS region (required)")
 | 
				
			|||||||
rootCmd.MarkFlagRequired("region")
 | 
					rootCmd.MarkFlagRequired("region")
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Or, for persistent flags:
 | 
				
			||||||
 | 
					```go
 | 
				
			||||||
 | 
					rootCmd.PersistentFlags().StringVarP(&Region, "region", "r", "", "AWS region (required)")
 | 
				
			||||||
 | 
					rootCmd.MarkPersistentFlagRequired("region")
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Positional and Custom Arguments
 | 
					## Positional and Custom Arguments
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Validation of positional arguments can be specified using the `Args` field
 | 
					Validation of positional arguments can be specified using the `Args` field
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user