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

Function confirmInitPlan

apps/cli/internal/cli/project_init.go:310–350  ·  view source on GitHub ↗

confirmInitPlan shows what will be created and asks the user to confirm. Returns true if the user confirms, false if cancelled.

(root, taskDirAbs string, rootFiles, taskDirFiles []fileToWrite)

Source from the content-addressed store, hash-verified

308// confirmInitPlan shows what will be created and asks the user to confirm.
309// Returns true if the user confirms, false if cancelled.
310func confirmInitPlan(root, taskDirAbs string, rootFiles, taskDirFiles []fileToWrite) bool {
311 fmt.Println("\nThe following will be created:")
312
313 // Task directory
314 abs, _ := filepath.Abs(taskDirAbs)
315 fmt.Printf(" %s/\n", abs)
316
317 // Config file
318 configAbs, _ := filepath.Abs(filepath.Join(root, configFilename))
319 fmt.Printf(" %s\n", configAbs)
320
321 // Root files
322 for _, f := range rootFiles {
323 p, _ := filepath.Abs(filepath.Join(root, f.filename))
324 fmt.Printf(" %s\n", p)
325 }
326
327 // Task dir files
328 for _, f := range taskDirFiles {
329 p, _ := filepath.Abs(filepath.Join(taskDirAbs, f.filename))
330 fmt.Printf(" %s\n", p)
331 }
332
333 // Templates
334 if !projectInitNoTemplates {
335 tmplAbs, _ := filepath.Abs(filepath.Join(root, ".taskmd", "templates"))
336 fmt.Printf(" %s/\n", tmplAbs)
337 }
338
339 fmt.Println()
340
341 confirm := true
342 err := huh.NewConfirm().
343 Title("Proceed?").
344 Value(&confirm).
345 Run()
346 if err != nil {
347 return false
348 }
349 return confirm
350}
351
352// idStrategyConfig holds the resolved ID strategy and associated settings.
353type idStrategyConfig struct {

Callers 1

runProjectInitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected