From 8b8ee8754cb7ad722506484737722720732992b6 Mon Sep 17 00:00:00 2001 From: janhn Date: Mon, 6 Feb 2023 12:15:40 +0100 Subject: [PATCH] Improve MarkFlagsMutuallyExclusive example in User Guide (#1904) --- user_guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide.md b/user_guide.md index fee9848dc..00b53d03c 100644 --- a/user_guide.md +++ b/user_guide.md @@ -313,8 +313,8 @@ rootCmd.MarkFlagsRequiredTogether("username", "password") You can also prevent different flags from being provided together if they represent mutually exclusive options such as specifying an output format as either `--json` or `--yaml` but never both: ```go -rootCmd.Flags().BoolVar(&u, "json", false, "Output in JSON") -rootCmd.Flags().BoolVar(&pw, "yaml", false, "Output in YAML") +rootCmd.Flags().BoolVar(&ofJson, "json", false, "Output in JSON") +rootCmd.Flags().BoolVar(&ofYaml, "yaml", false, "Output in YAML") rootCmd.MarkFlagsMutuallyExclusive("json", "yaml") ```