21 lines
397 B
Go
21 lines
397 B
Go
package formatter
|
|
|
|
import (
|
|
"fmt"
|
|
"path/filepath"
|
|
"strings"
|
|
|
|
"sub-cli/internal/format/lrc"
|
|
)
|
|
|
|
// Format formats a subtitle file to ensure consistent formatting
|
|
func Format(filePath string) error {
|
|
ext := strings.TrimPrefix(filepath.Ext(filePath), ".")
|
|
|
|
switch ext {
|
|
case "lrc":
|
|
return lrc.Format(filePath)
|
|
default:
|
|
return fmt.Errorf("unsupported format for formatting: %s", ext)
|
|
}
|
|
}
|