MCPcopy Index your code
hub / github.com/ddev/ddev / docrootPrompt

Method docrootPrompt

pkg/ddevapp/config.go:1549–1576  ·  view source on GitHub ↗

docrootPrompt Determine the document root.

()

Source from the content-addressed store, hash-verified

1547
1548// docrootPrompt Determine the document root.
1549func (app *DdevApp) docrootPrompt() error {
1550 // Determine the document root.
1551 output.UserOut.Printf("\nThe docroot is the directory from which your site is served.\nThis is a relative path from your project root at %s\n", app.AppRoot)
1552 output.UserOut.Printf("Leave docroot empty (hit <RETURN>) to use the location shown in parentheses.\nOr specify a custom path if your index.php is in a different directory.\nOr use '.' (a dot) to explicitly set it to the project root.\n")
1553 var docrootPrompt = "Docroot Location"
1554 var defaultDocroot = DiscoverDefaultDocroot(app)
1555 // If there is a default docroot, display it in the prompt.
1556 if defaultDocroot != "" {
1557 docrootPrompt = fmt.Sprintf("%s (%s)", docrootPrompt, defaultDocroot)
1558 } else {
1559 docrootPrompt = fmt.Sprintf("%s (project root)", docrootPrompt)
1560 }
1561
1562 for {
1563 fmt.Print(docrootPrompt + ": ")
1564 app.Docroot = util.GetQuotedInput(defaultDocroot)
1565
1566 // Ensure that the docroot exists
1567 if err := app.CreateDocroot(); err != nil {
1568 output.UserOut.Print(util.ColorizeText(err.Error(), "yellow"))
1569 } else {
1570 output.UserOut.Println()
1571 break
1572 }
1573 }
1574
1575 return nil
1576}
1577
1578// ConfigExists determines if a DDEV config file exists for this application.
1579func (app *DdevApp) ConfigExists() bool {

Callers 1

PromptForConfigMethod · 0.95

Calls 5

CreateDocrootMethod · 0.95
GetQuotedInputFunction · 0.92
ColorizeTextFunction · 0.92
DiscoverDefaultDocrootFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected