From 6abbb9a7c9d275fc981ca074cfd982d0a88d6ef3 Mon Sep 17 00:00:00 2001 From: thepetk Date: Sun, 4 Jun 2023 02:55:44 +0100 Subject: [PATCH] Add cli args for devfiles Signed-off-by: thepetk --- go/pkg/cli/devfile/devfile.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/go/pkg/cli/devfile/devfile.go b/go/pkg/cli/devfile/devfile.go index 0b5be1bc..8d59bcce 100644 --- a/go/pkg/cli/devfile/devfile.go +++ b/go/pkg/cli/devfile/devfile.go @@ -6,7 +6,7 @@ import ( "github.com/spf13/cobra" ) -var registry string +var registry, minVersion, maxVersion string func NewCmdDevfile() *cobra.Command { devfileCmd := &cobra.Command{ @@ -16,6 +16,8 @@ func NewCmdDevfile() *cobra.Command { Args: cobra.MaximumNArgs(1), Run: doSelectDevfile, } + devfileCmd.Flags().StringVar(&minVersion, "min-version", "", "minimum version of devfile schemaVersion") + devfileCmd.Flags().StringVar(&maxVersion, "max-version", "", "maximum version of devfile schemaVersion") devfileCmd.Flags().StringVarP(®istry, "registry", "r", "", "registry where to download the devfiles. Default value: https://registry.devfile.io") return devfileCmd } @@ -26,7 +28,7 @@ func doSelectDevfile(cmd *cobra.Command, args []string) { return } if registry == "" { - registry = "https://registry.devfile.io/index" + registry = "https://registry.devfile.io/" } - utils.PrintPrettifyOutput(recognizer.SelectDevFilesFromRegistry(args[0], registry)) + utils.PrintPrettifyOutput(recognizer.MatchDevfiles(args[0], registry, minVersion, maxVersion)) }