MCPcopy Create free account
hub / github.com/auth0/auth0-cli / copyProjectTemplateFiles

Function copyProjectTemplateFiles

internal/cli/acul_app_scaffolding.go:413–442  ·  view source on GitHub ↗
(cli *cli, baseFiles []string, chosenTemplate, tempUnzipDir, destDir string)

Source from the content-addressed store, hash-verified

411}
412
413func copyProjectTemplateFiles(cli *cli, baseFiles []string, chosenTemplate, tempUnzipDir, destDir string) error {
414 extractedDir, err := findExtractedRepoDir(tempUnzipDir)
415 if err != nil {
416 return fmt.Errorf("failed to find extracted directory: %w", err)
417 }
418
419 sourcePathPrefix := filepath.Join(extractedDir, chosenTemplate)
420
421 for _, filePath := range baseFiles {
422 srcPath := filepath.Join(tempUnzipDir, sourcePathPrefix, filePath)
423 destPath := filepath.Join(destDir, filePath)
424
425 if _, err := os.Stat(srcPath); os.IsNotExist(err) {
426 cli.renderer.Warnf("⚠️ Source file does not exist: %s", ansi.Faint(srcPath))
427 continue
428 }
429
430 parentDir := filepath.Dir(destPath)
431 if err := os.MkdirAll(parentDir, 0755); err != nil {
432 cli.renderer.Warnf("❌ Error creating parent directory for %s: %v", ansi.Bold(filePath), err)
433 continue
434 }
435
436 if err := copyFile(srcPath, destPath); err != nil {
437 return fmt.Errorf("error copying file %s: %w", filePath, err)
438 }
439 }
440
441 return nil
442}
443
444func copyProjectScreens(cli *cli, screens []Screens, selectedScreens []string, chosenTemplate, tempUnzipDir, destDir string) error {
445 extractedDir, err := findExtractedRepoDir(tempUnzipDir)

Callers 2

runScaffoldFunction · 0.85
copyProjectScreensFunction · 0.85

Calls 6

FaintFunction · 0.92
BoldFunction · 0.92
findExtractedRepoDirFunction · 0.85
copyFileFunction · 0.85
ErrorfMethod · 0.80
WarnfMethod · 0.80

Tested by

no test coverage detected