AppTypePrompt handles the Type workflow.
()
| 1585 | |
| 1586 | // AppTypePrompt handles the Type workflow. |
| 1587 | func (app *DdevApp) AppTypePrompt() error { |
| 1588 | // First, see if we can auto detect what kind of site it is so we can set a sane default. |
| 1589 | detectedAppType := app.DetectAppType() |
| 1590 | |
| 1591 | // If we found an application type set it and inform the user. |
| 1592 | util.Success("Found a %s codebase at %s.", detectedAppType, app.GetAbsDocroot(false)) |
| 1593 | |
| 1594 | validAppTypes := strings.Join(GetValidAppTypes(), ", ") |
| 1595 | typePrompt := "Project Type [%s] (%s): " |
| 1596 | |
| 1597 | defaultAppType := app.Type |
| 1598 | if app.Type == nodeps.AppTypeNone || !IsValidAppType(app.Type) { |
| 1599 | defaultAppType = detectedAppType |
| 1600 | } |
| 1601 | |
| 1602 | appType := "" |
| 1603 | |
| 1604 | for { |
| 1605 | fmt.Printf(typePrompt, validAppTypes, defaultAppType) |
| 1606 | appType = strings.ToLower(util.GetInput(defaultAppType)) |
| 1607 | if IsValidAppType(appType) { |
| 1608 | break |
| 1609 | } |
| 1610 | output.UserOut.Print(util.ColorizeText(fmt.Sprintf("'%s' is not a valid project type", appType), "yellow")) |
| 1611 | } |
| 1612 | |
| 1613 | app.Type = appType |
| 1614 | |
| 1615 | return nil |
| 1616 | } |
| 1617 | |
| 1618 | // PrepDdevDirectory creates a .ddev directory in the current working directory |
| 1619 | func PrepDdevDirectory(app *DdevApp) error { |