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

Function runGet

apps/cli/internal/cli/get.go:72–111  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

70}
71
72func runGet(cmd *cobra.Command, args []string) error {
73 flags := GetGlobalFlags()
74 query := args[0]
75
76 scanDir := ResolveScanDir(nil)
77
78 taskScanner := scanner.NewScanner(scanDir, flags.Verbose, flags.IgnoreDirs)
79 result, err := taskScanner.Scan()
80 if err != nil {
81 return fmt.Errorf("scan failed: %w", err)
82 }
83
84 tasks := result.Tasks
85 makeFilePathsRelative(tasks, scanDir)
86
87 task, err := resolveTask(query, tasks, getExact, getThreshold)
88 if err != nil {
89 return err
90 }
91
92 depInfo := buildDependencyInfo(task, tasks)
93
94 var ctxFiles []taskcontext.FileEntry
95 if getShowContext {
96 scopes := loadScopePathsConfig()
97 projectRoot := resolveProjectRoot()
98 opts := taskcontext.Options{
99 Scopes: scopes,
100 ProjectRoot: projectRoot,
101 }
102 ctxResult, err := taskcontext.Resolve(task, opts)
103 if err == nil {
104 ctxFiles = ctxResult.Files
105 }
106 }
107
108 wlInfo := loadWorklogInfo(task, scanDir)
109
110 return outputGet(task, depInfo, ctxFiles, wlInfo, getFormat)
111}
112
113// worklogInfo holds optional worklog metadata for display.
114type worklogInfo struct {

Calls 10

ScanMethod · 0.95
GetGlobalFlagsFunction · 0.85
ResolveScanDirFunction · 0.85
makeFilePathsRelativeFunction · 0.85
resolveTaskFunction · 0.85
buildDependencyInfoFunction · 0.85
loadScopePathsConfigFunction · 0.85
resolveProjectRootFunction · 0.85
loadWorklogInfoFunction · 0.85
outputGetFunction · 0.85

Tested by 9

captureGetOutputFunction · 0.68
TestGet_ThresholdFunction · 0.68
TestGet_EmptyDirectoryFunction · 0.68