mirror of
				https://github.com/redhat-developer/odo.git
				synced 2025-10-19 03:06:19 +03:00 
			
		
		
		
	remove showing help twice for incorrect commands (#3805)
* remove showing help twice for incorrect commands * regression to check output happen only once
This commit is contained in:
		| @@ -272,6 +272,5 @@ func ShowHelp(cmd *cobra.Command, args []string) error { | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
| 	_ = cmd.Help() | ||||
| 	return fmt.Errorf("Invalid command - see available commands/subcommands above") | ||||
| } | ||||
|   | ||||
| @@ -5,6 +5,7 @@ import ( | ||||
| 	"os" | ||||
| 	"path/filepath" | ||||
| 	"regexp" | ||||
| 	"strings" | ||||
| 	"time" | ||||
|  | ||||
| 	. "github.com/onsi/ginkgo" | ||||
| @@ -46,6 +47,11 @@ var _ = Describe("odo generic", func() { | ||||
| 			Expect(output).To(ContainSubstring("Subcommand not found, use one of the available commands")) | ||||
| 		}) | ||||
|  | ||||
| 		It("Fail with showing help only once for incorrect command", func() { | ||||
| 			output := helper.CmdShouldFail("odo", "hello") | ||||
| 			Expect(strings.Count(output, "odo [flags]")).Should(Equal(1)) | ||||
| 		}) | ||||
|  | ||||
| 	}) | ||||
|  | ||||
| 	Context("When executing catalog list without component directory", func() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Girish Ramnani
					Girish Ramnani