MCPcopy Create free account
hub / github.com/campoy/embedmd / parsingCmd

Function parsingCmd

embedmd/parser.go:78–97  ·  view source on GitHub ↗
(out io.Writer, s textScanner, run commandRunner)

Source from the content-addressed store, hash-verified

76}
77
78func parsingCmd(out io.Writer, s textScanner, run commandRunner) (state, error) {
79 line := s.Text()
80 fmt.Fprintln(out, line)
81 args := line[strings.Index(line, "#")+1:]
82 cmd, err := parseCommand(args)
83 if err != nil {
84 return nil, err
85 }
86 if err := run(out, cmd); err != nil {
87 return nil, err
88 }
89 if !s.Scan() {
90 return nil, nil // end of file, which is fine.
91 }
92 if strings.HasPrefix(s.Text(), "```") {
93 return codeParser{print: false}.parse, nil
94 }
95 fmt.Fprintln(out, s.Text())
96 return parsingText, nil
97}
98
99type codeParser struct{ print bool }
100

Callers

nothing calls this directly

Calls 3

parseCommandFunction · 0.85
TextMethod · 0.80
ScanMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…