(out io.Writer, s textScanner, run commandRunner)
| 76 | } |
| 77 | |
| 78 | func 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 | |
| 99 | type codeParser struct{ print bool } |
| 100 |
nothing calls this directly
no test coverage detected
searching dependent graphs…