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

Function promptSelection

apps/cli/internal/cli/get.go:335–354  ·  view source on GitHub ↗

promptSelection displays fuzzy matches and asks the user to pick one.

(query string, matches []fuzzyMatch)

Source from the content-addressed store, hash-verified

333
334// promptSelection displays fuzzy matches and asks the user to pick one.
335func promptSelection(query string, matches []fuzzyMatch) (*model.Task, error) {
336 fmt.Fprintf(os.Stderr, "No exact match found for %q. Did you mean:\n\n", query)
337 for i, m := range matches {
338 fmt.Fprintf(os.Stderr, " %d. %s: %s (%.0f%% match) [%s]\n",
339 i+1, m.Task.ID, m.Task.Title, m.Score*100, m.Task.FilePath)
340 }
341 fmt.Fprintf(os.Stderr, "\nEnter selection (1-%d), or 0 to cancel: ", len(matches))
342
343 reader := bufio.NewReader(getStdinReader)
344 var choice int
345 line, _ := reader.ReadString('\n')
346 line = strings.TrimSpace(line)
347 if _, err := fmt.Sscanf(line, "%d", &choice); err != nil || choice < 0 || choice > len(matches) {
348 return nil, fmt.Errorf("invalid selection")
349 }
350 if choice == 0 {
351 return nil, fmt.Errorf("selection cancelled")
352 }
353 return matches[choice-1].Task, nil
354}
355
356// buildDependencyInfo resolves depends-on and blocks lists for a task.
357func buildDependencyInfo(task *model.Task, allTasks []*model.Task) dependencyInfo {

Callers 1

resolveTaskFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected