Skip to content

Commit

Permalink
Merge branch 'main' into CLI-47
Browse files Browse the repository at this point in the history
  • Loading branch information
bright-poku authored Mar 5, 2021
2 parents ef95f2f + 72c1a66 commit aba9ce3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
Binary file modified demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 25 additions & 8 deletions internal/cli/quickstarts.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,27 +253,44 @@ func quickstartPathFor(client *management.Client) (p string, exists bool, err er
return target, exists, nil
}

func getQuickstart(typ, stack string) (quickstart, error) {
quickstarts, ok := quickstartsByType[typ]
func getQuickstart(t, stack string) (quickstart, error) {
qsType := quickstartsTypeFor(t)
quickstarts, ok := quickstartsByType[qsType]
if !ok {
return quickstart{}, fmt.Errorf("Unknown quickstart type %s", typ)
return quickstart{}, fmt.Errorf("Unknown quickstart type %s", qsType)
}
for _, q := range quickstarts {
if q.Name == stack {
return q, nil
}
}
return quickstart{}, fmt.Errorf("Quickstart not found for %s/%s", typ, stack)
return quickstart{}, fmt.Errorf("Quickstart not found for %s/%s", qsType, stack)
}

func quickstartStacksFromType(t string) ([]string, error) {
_, ok := quickstartsByType[t]
qsType := quickstartsTypeFor(t)
_, ok := quickstartsByType[qsType]
if !ok {
return nil, fmt.Errorf("Unknown quickstart type %s", t)
return nil, fmt.Errorf("Unknown quickstart type %s", qsType)
}
stacks := make([]string, 0, len(quickstartsByType[t]))
for _, s := range quickstartsByType[t] {
stacks := make([]string, 0, len(quickstartsByType[qsType]))
for _, s := range quickstartsByType[qsType] {
stacks = append(stacks, s.Name)
}
return stacks, nil
}

func quickstartsTypeFor(v string) string {
switch {
case v == "native":
return "native"
case v == "spa":
return "spa"
case v == "regular_web":
return "webapp"
case v == "non_interactive":
return "backend"
default:
return "generic"
}
}

0 comments on commit aba9ce3

Please sign in to comment.