mirror of
https://github.com/ivuorinen/gibidify.git
synced 2026-01-26 11:34:03 +00:00
29 lines
914 B
Go
29 lines
914 B
Go
package fileproc
|
|
|
|
// FileData represents a single file's path and content.
|
|
type FileData struct {
|
|
Path string `json:"path" yaml:"path"`
|
|
Content string `json:"content" yaml:"content"`
|
|
Language string `json:"language" yaml:"language"`
|
|
}
|
|
|
|
// OutputData represents the full output structure.
|
|
type OutputData struct {
|
|
Prefix string `json:"prefix,omitempty" yaml:"prefix,omitempty"`
|
|
Suffix string `json:"suffix,omitempty" yaml:"suffix,omitempty"`
|
|
Files []FileData `json:"files" yaml:"files"`
|
|
}
|
|
|
|
// FormatWriter defines the interface for format-specific writers.
|
|
type FormatWriter interface {
|
|
Start(prefix, suffix string) error
|
|
WriteFile(req WriteRequest) error
|
|
Close() error
|
|
}
|
|
|
|
// detectLanguage tries to infer the code block language from the file extension.
|
|
func detectLanguage(filePath string) string {
|
|
registry := GetDefaultRegistry()
|
|
return registry.GetLanguage(filePath)
|
|
}
|