Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
Add cli args for devfiles
Browse files Browse the repository at this point in the history
Signed-off-by: thepetk <thepetk@gmail.com>
  • Loading branch information
thepetk committed Jun 4, 2023
1 parent 1136776 commit 6abbb9a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions go/pkg/cli/devfile/devfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra"
)

var registry string
var registry, minVersion, maxVersion string

func NewCmdDevfile() *cobra.Command {
devfileCmd := &cobra.Command{
Expand All @@ -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(&registry, "registry", "r", "", "registry where to download the devfiles. Default value: https://registry.devfile.io")
return devfileCmd
}
Expand All @@ -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))
}

0 comments on commit 6abbb9a

Please sign in to comment.