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

Method ResolveInput

apps/cli/internal/cli/input.go:32–49  ·  view source on GitHub ↗

ResolveInput determines the input source and returns a reader and cleanup function Priority: stdin flag > explicit file argument > default tasks.md file

(args []string)

Source from the content-addressed store, hash-verified

30// ResolveInput determines the input source and returns a reader and cleanup function
31// Priority: stdin flag > explicit file argument > default tasks.md file
32func (ir *InputResolver) ResolveInput(args []string) (io.Reader, func() error, error) {
33 // Case 1: Read from stdin
34 if ir.useStdin {
35 if ir.verbose {
36 fmt.Fprintln(os.Stderr, "Reading from stdin...")
37 }
38 return os.Stdin, func() error { return nil }, nil
39 }
40
41 // Case 2: Explicit file path provided
42 if len(args) > 0 {
43 filePath := args[0]
44 return ir.openFile(filePath)
45 }
46
47 // Case 3: Default to tasks.md in current directory
48 return ir.openFile(DefaultTaskFile)
49}
50
51// openFile opens a file and returns a reader and cleanup function
52func (ir *InputResolver) openFile(filePath string) (io.Reader, func() error, error) {

Callers 2

ReadAllMethod · 0.95

Calls 1

openFileMethod · 0.95

Tested by 1