| 29 | } |
| 30 | |
| 31 | func (p *Program) main(files []string, input io.Reader, output, stderr io.Writer) int { |
| 32 | err := p.run(files, input, output) |
| 33 | if err != nil { |
| 34 | var derr *toml.DecodeError |
| 35 | if errors.As(err, &derr) { |
| 36 | _, _ = fmt.Fprintln(stderr, derr.String()) |
| 37 | row, col := derr.Position() |
| 38 | _, _ = fmt.Fprintln(stderr, "error occurred at row", row, "column", col) |
| 39 | } else { |
| 40 | _, _ = fmt.Fprintln(stderr, err.Error()) |
| 41 | } |
| 42 | |
| 43 | return -1 |
| 44 | } |
| 45 | return 0 |
| 46 | } |
| 47 | |
| 48 | func (p *Program) run(files []string, input io.Reader, output io.Writer) error { |
| 49 | if len(files) > 0 { |