From 17573c4ae7f04ec82aed56e93458b9e59956eca6 Mon Sep 17 00:00:00 2001 From: Donia Chaiehloudj Date: Thu, 20 Oct 2022 21:39:53 +0200 Subject: [PATCH] Replace deprecated ExactValidArgs with MatchAll in user_guide and shell_completions example --- shell_completions.md | 2 +- user_guide.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shell_completions.md b/shell_completions.md index 553ee5df8..286c2525b 100644 --- a/shell_completions.md +++ b/shell_completions.md @@ -71,7 +71,7 @@ PowerShell: `,cmd.Root().Name()), DisableFlagsInUseLine: true, ValidArgs: []string{"bash", "zsh", "fish", "powershell"}, - Args: cobra.ExactValidArgs(1), + Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), Run: func(cmd *cobra.Command, args []string) { switch args[0] { case "bash": diff --git a/user_guide.md b/user_guide.md index 977306aa8..6a686e30c 100644 --- a/user_guide.md +++ b/user_guide.md @@ -349,7 +349,7 @@ shown below: ```go var cmd = &cobra.Command{ Short: "hello", - Args: MatchAll(ExactArgs(2), OnlyValidArgs), + Args: cobra.MatchAll(cobra.ExactArgs(2), cobra.OnlyValidArgs), Run: func(cmd *cobra.Command, args []string) { fmt.Println("Hello, World!") },