From bd47b67ea0fa06094215eff062dbf70b7f43821c Mon Sep 17 00:00:00 2001 From: akhilmhdh Date: Wed, 28 Dec 2022 16:54:27 +0530 Subject: [PATCH] feat: added apiType and url required flags to cli --- internal/cli/cli.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/cli/cli.go b/internal/cli/cli.go index 7e151f1..1fcee1e 100644 --- a/internal/cli/cli.go +++ b/internal/cli/cli.go @@ -8,14 +8,23 @@ import ( ) func Run() { + var apiType string + var apiURL string + rootCmd := &cobra.Command{ Use: "apc", Short: "One shot cli for your api schema security,performance and quality check", Run: func(cmd *cobra.Command, args []string) { - fmt.Println("API Catalog CLI is running....") + fmt.Println(apiType) }, } + rootCmd.PersistentFlags().StringVarP(&apiType, "apiType", "a", "", "Your API Type. Allowed values: rest | graphql") + rootCmd.MarkPersistentFlagRequired("apiType") + + rootCmd.PersistentFlags().StringVar(&apiURL, "url", "", "URL or local file containing spec sheet") + rootCmd.MarkPersistentFlagRequired("url") + if err := rootCmd.Execute(); err != nil { fmt.Println(err) os.Exit(1)