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:
shreyas-goenka 2023-10-16 10:36:01 +02:00 committed by GitHub
parent 36f30c8b47
commit b2cb691988
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -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