(dir string, format Format)
| 69 | } |
| 70 | |
| 71 | func (g *Generator) Generate(dir string, format Format) error { |
| 72 | if err := os.MkdirAll(dir, os.ModePerm); err != nil { |
| 73 | return err |
| 74 | } |
| 75 | |
| 76 | switch format { |
| 77 | case FormatMarkdown: |
| 78 | return g.renderTablesAsMarkdown(dir) |
| 79 | case FormatJSON: |
| 80 | return g.renderTablesAsJSON(dir) |
| 81 | default: |
| 82 | return fmt.Errorf("unsupported format: %v", format) |
| 83 | } |
| 84 | } |