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

Function ensureTaskDir

apps/cli/internal/cli/project_init.go:615–631  ·  view source on GitHub ↗

ensureTaskDir creates the task directory if it doesn't exist.

(path string, quiet bool)

Source from the content-addressed store, hash-verified

613
614// ensureTaskDir creates the task directory if it doesn't exist.
615func ensureTaskDir(path string, quiet bool) (created bool, err error) {
616 info, statErr := os.Stat(path)
617 if statErr == nil {
618 if !info.IsDir() {
619 return false, fmt.Errorf("not a directory: %s", path)
620 }
621 if !quiet {
622 fmt.Fprintf(os.Stderr, "Task directory already exists: %s\n", path)
623 }
624 return false, nil
625 }
626
627 if err := os.MkdirAll(path, 0755); err != nil {
628 return false, fmt.Errorf("failed to create task directory: %w", err)
629 }
630 return true, nil
631}
632
633// writeConfigFile writes .taskmd.yaml to the project root.
634func writeConfigFile(root, taskDirPath string, idStrategy idStrategyConfig, quiet bool) (created bool, err error) {

Callers 1

writeProjectFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected