mirror of https://github.com/databricks/cli.git
Add alias for mlops-stack template URL (#869)
## Changes Allows users to initialize mlops-stack by running `bundle init mlops-stack` ## Tests Manually ``` shreyas.goenka@THW32HFW6T playground % cli bundle init Template to use [default-python]: mlops-stack Project Name [my-mlops-project]: ^C shreyas.goenka@THW32HFW6T playground % cli bundle init mlops-stack Project Name [my-mlops-project]: ^C ```
This commit is contained in:
parent
36f30c8b47
commit
b2cb691988
|
@ -18,6 +18,10 @@ var gitUrlPrefixes = []string{
|
||||||
"git@",
|
"git@",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var aliasedTemplates = map[string]string{
|
||||||
|
"mlops-stack": "https://github.com/databricks/mlops-stack",
|
||||||
|
}
|
||||||
|
|
||||||
func isRepoUrl(url string) bool {
|
func isRepoUrl(url string) bool {
|
||||||
result := false
|
result := false
|
||||||
for _, prefix := range gitUrlPrefixes {
|
for _, prefix := range gitUrlPrefixes {
|
||||||
|
@ -68,6 +72,11 @@ func newInitCommand() *cobra.Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Expand templatePath if it's an alias for a known template
|
||||||
|
if _, ok := aliasedTemplates[templatePath]; ok {
|
||||||
|
templatePath = aliasedTemplates[templatePath]
|
||||||
|
}
|
||||||
|
|
||||||
if !isRepoUrl(templatePath) {
|
if !isRepoUrl(templatePath) {
|
||||||
// skip downloading the repo because input arg is not a URL. We assume
|
// skip downloading the repo because input arg is not a URL. We assume
|
||||||
// it's a path on the local file system in that case
|
// it's a path on the local file system in that case
|
||||||
|
|
Loading…
Reference in New Issue