MCPcopy Create free account
hub / github.com/driangle/taskmd / writeInitFiles

Function writeInitFiles

apps/cli/internal/cli/project_init.go:672–690  ·  view source on GitHub ↗

writeInitFiles writes files to a directory, returning created paths.

(dir string, files []fileToWrite, quiet bool)

Source from the content-addressed store, hash-verified

670
671// writeInitFiles writes files to a directory, returning created paths.
672func writeInitFiles(dir string, files []fileToWrite, quiet bool) ([]string, error) {
673 var created []string
674
675 for _, f := range files {
676 absPath, skipped, err := writeInitFile(dir, f)
677 if err != nil {
678 return created, err
679 }
680 if skipped {
681 if !quiet {
682 fmt.Fprintf(os.Stderr, "Skipped %s (already exists, use --force to overwrite)\n", absPath)
683 }
684 continue
685 }
686 created = append(created, absPath)
687 }
688
689 return created, nil
690}
691
692func writeInitFile(targetDir string, f fileToWrite) (absPath string, skipped bool, err error) {
693 outputPath := filepath.Join(targetDir, f.filename)

Callers 2

writeProjectFilesFunction · 0.85
writeBuiltinTemplatesFunction · 0.85

Calls 1

writeInitFileFunction · 0.85

Tested by

no test coverage detected